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
Specifications
Specification | Status | Comment |
---|---|---|
DOM CustomEvent |
Living Standard | Initial definition, but already deprecated in favor of the use of a constructor, CustomEvent() |
Browser compatibility
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
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
CustomEvent
- The constructor to use instead of this deprecated method:
CustomEvent()
.