この記事は技術レビューを必要としています。ぜひご協力ください。
この記事はまだボランティアによって 日本語 に翻訳されていません。ぜひ MDN に参加して翻訳を手伝ってください!
The Event() constructor creates a new Event.
Syntax
event = new Event(typeArg, eventInit);
Values
- typeArg
- Is a
DOMStringrepresenting the name of the event. - eventInit Optional
- Is an
EventInitdictionary, having the following fields:"bubbles": (Optional) ABooleanindicating whether the event bubbles. The default isfalse."cancelable": (Optional) ABooleanindicating whether the event can be canceled. The default isfalse."scoped": (Optional) ABooleanindicating whether the given event bubbles. If this value istrue,deepPathwill only contain a target node."composed": (Optional) ABooleanindicating whether the event will trigger listeners outside of a shadow root. The default isfalse.
Example
// create a look event that bubbles up and cannot be canceled
var ev = new Event("look", {"bubbles":true, "cancelable":false});
document.dispatchEvent(ev);
Specifications
| Specification | Status | Comment |
|---|---|---|
| DOM The definition of 'Event()' in that specification. |
Living Standard | Initial definition. |
| Shadow DOM The definition of 'scoped' in that specification. |
Working Draft | Adds scoped to EventInit dictionary. |
Browser compatibility
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
|---|---|---|---|---|---|
| BasicSupport | 15.0 | 11 (11) | No support | 11.60 | Nightly build (535.2) |
scoped |
53.0 | ? | ? | ? | ? |
| Feature | Android | Android Webview | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile | Chrome for Android |
|---|---|---|---|---|---|---|---|
| Basic support | ? | (Yes) | 11.0 (11) | ? | ? | ? | (Yes) |
scoped |
No support | 53.0 | ? | ? | ? | ? | 53.0 |