2 * Copyright 2008 The Closure Compiler Authors
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * @fileoverview Definitions for W3C's event specification.
19 * The whole file has been fully type annotated.
21 * http://www.w3.org/TR/DOM-Level-2-Events/ecma-script-binding.html
30 function EventTarget() {}
33 * @param {string} type
34 * @param {EventListener|function(!Event):(boolean|undefined)} listener
35 * @param {boolean} useCapture
38 EventTarget.prototype.addEventListener = function(type, listener, useCapture)
42 * @param {string} type
43 * @param {EventListener|function(!Event):(boolean|undefined)} listener
44 * @param {boolean} useCapture
47 EventTarget.prototype.removeEventListener = function(type, listener, useCapture)
54 EventTarget.prototype.dispatchEvent = function(evt) {};
59 function EventListener() {}
65 EventListener.prototype.handleEvent = function(evt) {};
67 // The EventInit interface and the parameters to the Event constructor are part
68 // of DOM Level 3 (suggested) and the DOM "Living Standard" (mandated). They are
69 // included here as externs cannot be redefined. The same applies to other
70 // *EventInit interfaces and *Event constructors throughout this file. See:
71 // http://www.w3.org/TR/DOM-Level-3-Events/#event-initializers
72 // http://dom.spec.whatwg.org/#constructing-events
73 // https://dvcs.w3.org/hg/d4e/raw-file/tip/source_respec.htm#event-constructors
77 * bubbles: (boolean|undefined),
78 * cancelable: (boolean|undefined)
85 * @param {string} type
86 * @param {EventInit=} opt_eventInitDict
88 function Event(type, opt_eventInitDict) {}
92 * @see http://www.w3.org/TR/DOM-Level-2-Events/ecma-script-binding.html
98 * @see http://www.w3.org/TR/DOM-Level-2-Events/ecma-script-binding.html
100 Event.BUBBLING_PHASE;
104 * @see http://www.w3.org/TR/DOM-Level-2-Events/ecma-script-binding.html
106 Event.CAPTURING_PHASE;
109 /** @type {string} */
110 Event.prototype.type;
112 /** @type {EventTarget} */
113 Event.prototype.target;
115 /** @type {EventTarget} */
116 Event.prototype.currentTarget;
118 /** @type {number} */
119 Event.prototype.eventPhase;
121 /** @type {boolean} */
122 Event.prototype.bubbles;
124 /** @type {boolean} */
125 Event.prototype.cancelable;
127 /** @type {number} */
128 Event.prototype.timeStamp;
131 * Present for events spawned in browsers that support shadow dom.
132 * @type {Array.<!Element>|undefined}
134 Event.prototype.path;
137 * @return {undefined}
139 Event.prototype.stopPropagation = function() {};
142 * @return {undefined}
144 Event.prototype.preventDefault = function() {};
147 * @param {string} eventTypeArg
148 * @param {boolean} canBubbleArg
149 * @param {boolean} cancelableArg
150 * @return {undefined}
152 Event.prototype.initEvent = function(eventTypeArg, canBubbleArg, cancelableArg) {};
156 * bubbles: (boolean|undefined),
157 * cancelable: (boolean|undefined),
166 * @param {string} type
167 * @param {CustomEventInit=} opt_eventInitDict
168 * @see http://www.w3.org/TR/DOM-Level-3-Events/#interface-CustomEvent
170 function CustomEvent(type, opt_eventInitDict) {}
173 * @param {string} eventType
174 * @param {boolean} bubbles
175 * @param {boolean} cancelable
178 CustomEvent.prototype.initCustomEvent = function(
179 eventType, bubbles, cancelable, detail) {};
184 CustomEvent.prototype.detail;
189 function DocumentEvent() {}
192 * @param {string} eventType
195 DocumentEvent.prototype.createEvent = function(eventType) {};
199 * bubbles: (boolean|undefined),
200 * cancelable: (boolean|undefined),
201 * view: (Window|undefined),
202 * detail: (number|undefined)
210 * @param {string} type
211 * @param {UIEventInit=} opt_eventInitDict
213 function UIEvent(type, opt_eventInitDict) {}
215 /** @type {number} */
216 UIEvent.prototype.detail;
219 * @param {string} typeArg
220 * @param {boolean} canBubbleArg
221 * @param {boolean} cancelableArg
222 * @param {Window} viewArg
223 * @param {number} detailArg
224 * @return {undefined}
226 UIEvent.prototype.initUIEvent = function(typeArg, canBubbleArg, cancelableArg,
227 viewArg, detailArg) {};
231 * bubbles: (boolean|undefined),
232 * cancelable: (boolean|undefined),
233 * view: (Window|undefined),
234 * detail: (number|undefined),
235 * screenX: (number|undefined),
236 * screenY: (number|undefined),
237 * clientX: (number|undefined),
238 * clientY: (number|undefined),
239 * ctrlKey: (boolean|undefined),
240 * shiftKey: (boolean|undefined),
241 * altKey: (boolean|undefined),
242 * metaKey: (boolean|undefined),
243 * button: (number|undefined),
244 * buttons: (number|undefined),
245 * relatedTarget: (EventTarget|undefined)
253 * @param {string} type
254 * @param {MouseEventInit=} opt_eventInitDict
256 function MouseEvent(type, opt_eventInitDict) {}
258 /** @type {number} */
259 MouseEvent.prototype.screenX;
261 /** @type {number} */
262 MouseEvent.prototype.screenY;
264 /** @type {number} */
265 MouseEvent.prototype.clientX;
267 /** @type {number} */
268 MouseEvent.prototype.clientY;
270 /** @type {boolean} */
271 MouseEvent.prototype.ctrlKey;
273 /** @type {boolean} */
274 MouseEvent.prototype.shiftKey;
276 /** @type {boolean} */
277 MouseEvent.prototype.altKey;
279 /** @type {boolean} */
280 MouseEvent.prototype.metaKey;
282 /** @type {number} */
283 MouseEvent.prototype.button;
285 /** @type {EventTarget} */
286 MouseEvent.prototype.relatedTarget;
293 function MutationEvent() {}
296 MutationEvent.prototype.relatedNode;
298 /** @type {string} */
299 MutationEvent.prototype.prevValue;
301 /** @type {string} */
302 MutationEvent.prototype.newValue;
304 /** @type {string} */
305 MutationEvent.prototype.attrName;
307 /** @type {number} */
308 MutationEvent.prototype.attrChange;
311 * @param {string} typeArg
312 * @param {boolean} canBubbleArg
313 * @param {boolean} cancelableArg
314 * @param {Node} relatedNodeArg
315 * @param {string} prevValueArg
316 * @param {string} newValueArg
317 * @param {string} attrNameArg
318 * @param {number} attrChangeArg
319 * @return {undefined}
321 MutationEvent.prototype.initMutationEvent = function(typeArg, canBubbleArg, cancelableArg, relatedNodeArg, prevValueArg, newValueArg, attrNameArg, attrChangeArg) {};
327 * bubbles: (boolean|undefined),
328 * cancelable: (boolean|undefined),
329 * view: (Window|undefined),
330 * detail: (number|undefined),
331 * char: (string|undefined),
332 * key: (string|undefined),
333 * code: (string|undefined),
334 * location: (number|undefined),
335 * ctrlKey: (boolean|undefined),
336 * shiftKey: (boolean|undefined),
337 * altKey: (boolean|undefined),
338 * metaKey: (boolean|undefined),
339 * repeat: (boolean|undefined),
340 * locale: (string|undefined)
343 var KeyboardEventInit;
348 * @param {string} type
349 * @param {KeyboardEventInit=} opt_eventInitDict
351 function KeyboardEvent(type, opt_eventInitDict) {}
353 /** @type {string} */
354 KeyboardEvent.prototype.keyIdentifier;
356 /** @type {boolean} */
357 KeyboardEvent.prototype.ctrlKey;
359 /** @type {boolean} */
360 KeyboardEvent.prototype.shiftKey;
362 /** @type {boolean} */
363 KeyboardEvent.prototype.altKey;
365 /** @type {boolean} */
366 KeyboardEvent.prototype.metaKey;
369 * @param {string} keyIdentifierArg
372 KeyboardEvent.prototype.getModifierState = function(keyIdentifierArg) {};