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