01: /*
02: * Copyright (c) 2006 World Wide Web Consortium,
03: *
04: * (Massachusetts Institute of Technology, European Research Consortium for
05: * Informatics and Mathematics, Keio University). All Rights Reserved. This
06: * work is distributed under the W3C(r) Software License [1] in the hope that
07: * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
08: * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
09: *
10: * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
11: */
12:
13: package org.w3c.dom.events;
14:
15: /**
16: * The <code>EventListener</code> interface is the primary way for handling
17: * events. Users implement the <code>EventListener</code> interface and
18: * register their event listener on an <code>EventTarget</code>. The users
19: * should also remove their <code>EventListener</code> from its
20: * <code>EventTarget</code> after they have completed using the listener.
21: * <p> Copying a <code>Node</code>, with methods such as
22: * <code>Node.cloneNode</code> or <code>Range.cloneContents</code>, does not
23: * copy the event listeners attached to it. Event listeners must be attached
24: * to the newly created <code>Node</code> afterwards if so desired.
25: * <p> Moving a <code>Node</code>, with methods <code>Document.adoptNode</code>
26: * , <code>Node.appendChild</code>, or <code>Range.extractContents</code>,
27: * does not affect the event listeners attached to it.
28: * <p>See also the <a href='http://www.w3.org/TR/2006/WD-DOM-Level-3-Events-20060413'>
29: Document Object Model (DOM) Level 3 Events Specification
30: </a>.
31: * @since DOM Level 2
32: */
33: public interface EventListener {
34: /**
35: * This method is called whenever an event occurs of the event type for
36: * which the <code>EventListener</code> interface was registered.
37: * @param evt The <code>Event</code> contains contextual information
38: * about the event.
39: */
40: public void handleEvent(Event evt);
41:
42: }
|