Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

CustomEvent.initCustomEvent()

这篇翻译不完整。请帮忙从英语翻译这篇文章

已废弃
该特性已经从 Web 标准中删除,虽然一些浏览器目前仍然支持它,但也许会在未来的某个时间停止支持,请尽量不要使用该特性。

CustomEvent.initCustomEvent() 方法初始化了一个 CustomEvent object. 如果该时间已经被分发出去,则不会在初始化过程中重复触发.

这类对象一定是由 Document.createEvent() 方法创建的. 该方法被分发之前必须通过EventTarget.dispatchEvent()方法设置.一旦被分发则,则无法被重新设置.

该方法已经作废,不要在新项目中继续使用该方法.

Instead use specific event constructors, like CustomEvent(). The page on Creating and triggering events gives more information about the way to use these.

Syntax

event.initCustomEvent(type, canBubble, cancelable, detail);

Parameters

type
类型DOMString,事件名称.
canBubble
类型Boolean,事件是否沿着dom树向上冒泡.
cancelable
类型Boolean,事件是否可取消.
detail
事件初始化时传入的数据.

Specifications

Specification Status Comment
DOM
CustomEvent
Living Standard Initial definition, but already deprecated in favor of the use of a constructor, CustomEvent()

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support (Yes) 6 (6) 9 11 5.1 (533.3)
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support ? 6.0 (6) ? ? ?

See also

文档标签和贡献者

 此页面的贡献者: superwf
 最后编辑者: superwf,