OLD | NEW |
(Empty) | |
| 1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
| 2 /* ***** BEGIN LICENSE BLOCK ***** |
| 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 4 * |
| 5 * The contents of this file are subject to the Mozilla Public License Version |
| 6 * 1.1 (the "License"); you may not use this file except in compliance with |
| 7 * the License. You may obtain a copy of the License at |
| 8 * http://www.mozilla.org/MPL/ |
| 9 * |
| 10 * Software distributed under the License is distributed on an "AS IS" basis, |
| 11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
| 12 * for the specific language governing rights and limitations under the |
| 13 * License. |
| 14 * |
| 15 * The Original Code is mozilla.org code. |
| 16 * |
| 17 * The Initial Developer of the Original Code is |
| 18 * Netscape Communications Corporation. |
| 19 * Portions created by the Initial Developer are Copyright (C) 2000 |
| 20 * the Initial Developer. All Rights Reserved. |
| 21 * |
| 22 * Contributor(s): |
| 23 * Tom Pixley <joki@netscape.com> (original author) |
| 24 * Johnny Stenback <jst@netscape.com> |
| 25 * |
| 26 * Alternatively, the contents of this file may be used under the terms of |
| 27 * either of the GNU General Public License Version 2 or later (the "GPL"), |
| 28 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
| 29 * in which case the provisions of the GPL or the LGPL are applicable instead |
| 30 * of those above. If you wish to allow use of your version of this file only |
| 31 * under the terms of either the GPL or the LGPL, and not to allow others to |
| 32 * use your version of this file under the terms of the MPL, indicate your |
| 33 * decision by deleting the provisions above and replace them with the notice |
| 34 * and other provisions required by the GPL or the LGPL. If you do not delete |
| 35 * the provisions above, a recipient may use your version of this file under |
| 36 * the terms of any one of the MPL, the GPL or the LGPL. |
| 37 * |
| 38 * ***** END LICENSE BLOCK ***** */ |
| 39 |
| 40 #include "domstubs.idl" |
| 41 |
| 42 /** |
| 43 * The nsIDOMEventTarget interface is the interface implemented by all |
| 44 * event targets in the Document Object Model. |
| 45 * |
| 46 * For more information on this interface please see |
| 47 * http://www.w3.org/TR/DOM-Level-2-Events/ |
| 48 * |
| 49 * @status FROZEN |
| 50 */ |
| 51 |
| 52 [scriptable, uuid(1c773b30-d1cf-11d2-bd95-00805f8ae3f4)] |
| 53 interface nsIDOMEventTarget : nsISupports |
| 54 { |
| 55 /** |
| 56 * This method allows the registration of event listeners on the event target. |
| 57 * If an EventListener is added to an EventTarget while it is processing an |
| 58 * event, it will not be triggered by the current actions but may be |
| 59 * triggered during a later stage of event flow, such as the bubbling phase. |
| 60 * |
| 61 * If multiple identical EventListeners are registered on the same |
| 62 * EventTarget with the same parameters the duplicate instances are |
| 63 * discarded. They do not cause the EventListener to be called twice |
| 64 * and since they are discarded they do not need to be removed with the |
| 65 * removeEventListener method. |
| 66 * |
| 67 * @param type The event type for which the user is registering |
| 68 * @param listener The listener parameter takes an interface |
| 69 * implemented by the user which contains the methods |
| 70 * to be called when the event occurs. |
| 71 * @param useCapture If true, useCapture indicates that the user |
| 72 * wishes to initiate capture. After initiating |
| 73 * capture, all events of the specified type will be |
| 74 * dispatched to the registered EventListener before |
| 75 * being dispatched to any EventTargets beneath them |
| 76 * in the tree. Events which are bubbling upward |
| 77 * through the tree will not trigger an |
| 78 * EventListener designated to use capture. |
| 79 */ |
| 80 void addEventListener(in DOMString type, |
| 81 in nsIDOMEventListener listener, |
| 82 in boolean useCapture); |
| 83 |
| 84 /** |
| 85 * This method allows the removal of event listeners from the event |
| 86 * target. If an EventListener is removed from an EventTarget while it |
| 87 * is processing an event, it will not be triggered by the current actions. |
| 88 * EventListeners can never be invoked after being removed. |
| 89 * Calling removeEventListener with arguments which do not identify any |
| 90 * currently registered EventListener on the EventTarget has no effect. |
| 91 * |
| 92 * @param type Specifies the event type of the EventListener being |
| 93 * removed. |
| 94 * @param listener The EventListener parameter indicates the |
| 95 * EventListener to be removed. |
| 96 * @param useCapture Specifies whether the EventListener being |
| 97 * removed was registered as a capturing listener or |
| 98 * not. If a listener was registered twice, one with |
| 99 * capture and one without, each must be removed |
| 100 * separately. Removal of a capturing listener does |
| 101 * not affect a non-capturing version of the same |
| 102 * listener, and vice versa. |
| 103 */ |
| 104 void removeEventListener(in DOMString type, |
| 105 in nsIDOMEventListener listener, |
| 106 in boolean useCapture); |
| 107 |
| 108 /** |
| 109 * This method allows the dispatch of events into the implementations |
| 110 * event model. Events dispatched in this manner will have the same |
| 111 * capturing and bubbling behavior as events dispatched directly by the |
| 112 * implementation. The target of the event is the EventTarget on which |
| 113 * dispatchEvent is called. |
| 114 * |
| 115 * @param evt Specifies the event type, behavior, and contextual |
| 116 * information to be used in processing the event. |
| 117 * @return Indicates whether any of the listeners which handled the |
| 118 * event called preventDefault. If preventDefault was called |
| 119 * the value is false, else the value is true. |
| 120 * @throws UNSPECIFIED_EVENT_TYPE_ERR: Raised if the Event's type was |
| 121 * not specified by initializing the event before |
| 122 * dispatchEvent was called. Specification of the Event's |
| 123 * type as null or an empty string will also trigger this |
| 124 * exception. |
| 125 */ |
| 126 boolean dispatchEvent(in nsIDOMEvent evt) |
| 127 raises(DOMException); |
| 128 }; |
OLD | NEW |