Event.webidl (3785B)
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 * You can obtain one at http://mozilla.org/MPL/2.0/. 5 * 6 * The origin of this IDL file is 7 * http://www.w3.org/TR/2012/WD-dom-20120105/ 8 * 9 * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C 10 * liability, trademark and document use rules apply. 11 */ 12 13 [Exposed=(Window,Worker,AudioWorklet), ProbablyShortLivingWrapper] 14 interface Event { 15 constructor(DOMString type, optional EventInit eventInitDict = {}); 16 17 [Pure] 18 readonly attribute DOMString type; 19 [Pure, BindingAlias="srcElement"] 20 readonly attribute EventTarget? target; 21 [Pure] 22 readonly attribute EventTarget? currentTarget; 23 24 sequence<EventTarget> composedPath(); 25 26 const unsigned short NONE = 0; 27 const unsigned short CAPTURING_PHASE = 1; 28 const unsigned short AT_TARGET = 2; 29 const unsigned short BUBBLING_PHASE = 3; 30 [Pure] 31 readonly attribute unsigned short eventPhase; 32 33 undefined stopPropagation(); 34 undefined stopImmediatePropagation(); 35 36 [Pure] 37 readonly attribute boolean bubbles; 38 [Pure] 39 readonly attribute boolean cancelable; 40 [NeedsCallerType] 41 attribute boolean returnValue; 42 [NeedsCallerType] 43 undefined preventDefault(); 44 [Pure, NeedsCallerType] 45 readonly attribute boolean defaultPrevented; 46 [ChromeOnly, Pure] 47 readonly attribute boolean defaultPreventedByChrome; 48 [ChromeOnly, Pure] 49 readonly attribute boolean defaultPreventedByContent; 50 [Pure] 51 readonly attribute boolean composed; 52 53 [LegacyUnforgeable, Pure] 54 readonly attribute boolean isTrusted; 55 [Pure] 56 readonly attribute DOMHighResTimeStamp timeStamp; 57 58 undefined initEvent(DOMString type, 59 optional boolean bubbles = false, 60 optional boolean cancelable = false); 61 attribute boolean cancelBubble; 62 }; 63 64 // Mozilla specific legacy stuff. 65 partial interface Event { 66 const long ALT_MASK = 0x00000001; 67 const long CONTROL_MASK = 0x00000002; 68 const long SHIFT_MASK = 0x00000004; 69 const long META_MASK = 0x00000008; 70 71 /** The original target of the event, before any retargetings. */ 72 [NeedsCallerType] 73 readonly attribute EventTarget? originalTarget; 74 /** 75 * The explicit original target of the event. If the event was retargeted 76 * for some reason other than an anonymous boundary crossing, this will be set 77 * to the target before the retargeting occurs. For example, mouse events 78 * are retargeted to their parent node when they happen over text nodes (bug 79 * 185889), and in that case .target will show the parent and 80 * .explicitOriginalTarget will show the text node. 81 * .explicitOriginalTarget differs from .originalTarget in that it will never 82 * contain anonymous content. 83 */ 84 readonly attribute EventTarget? explicitOriginalTarget; 85 [ChromeOnly] readonly attribute EventTarget? composedTarget; 86 [ChromeOnly] undefined preventMultipleActions(); 87 [ChromeOnly] readonly attribute boolean multipleActionsPrevented; 88 [ChromeOnly] readonly attribute boolean isSynthesized; 89 /** 90 * When the event target is a remote browser, calling this will fire an 91 * reply event in the chrome process. 92 */ 93 [ChromeOnly] undefined requestReplyFromRemoteContent(); 94 /** 95 * Returns true when the event shouldn't be handled by chrome. 96 */ 97 [ChromeOnly] readonly attribute boolean isWaitingReplyFromRemoteContent; 98 /** 99 * Returns true when the event is a reply event from a remote process. 100 */ 101 [ChromeOnly] readonly attribute boolean isReplyEventFromRemoteContent; 102 }; 103 104 dictionary EventInit { 105 boolean bubbles = false; 106 boolean cancelable = false; 107 boolean composed = false; 108 };