nsIDOMEvent.idl 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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 <[email protected]> (original author)
  24. * Johnny Stenback <[email protected]>
  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. #include "domstubs.idl"
  40. interface nsIDOMEventTarget;
  41. /**
  42. * The nsIDOMEvent interface is the primary datatype for all events in
  43. * the Document Object Model.
  44. *
  45. * For more information on this interface please see
  46. * http://www.w3.org/TR/DOM-Level-2-Events/
  47. *
  48. * @status FROZEN
  49. */
  50. [scriptable, uuid(a66b7b80-ff46-bd97-0080-5f8ae38add32)]
  51. interface nsIDOMEvent : nsISupports
  52. {
  53. // PhaseType
  54. /**
  55. * The current event phase is the capturing phase.
  56. */
  57. const unsigned short CAPTURING_PHASE = 1;
  58. /**
  59. * The event is currently being evaluated at the target EventTarget.
  60. */
  61. const unsigned short AT_TARGET = 2;
  62. /**
  63. * The current event phase is the bubbling phase.
  64. */
  65. const unsigned short BUBBLING_PHASE = 3;
  66. /**
  67. * The name of the event (case-insensitive). The name must be an XML
  68. * name.
  69. */
  70. readonly attribute DOMString type;
  71. /**
  72. * Used to indicate the EventTarget to which the event was originally
  73. * dispatched.
  74. */
  75. readonly attribute nsIDOMEventTarget target;
  76. /**
  77. * Used to indicate the EventTarget whose EventListeners are currently
  78. * being processed. This is particularly useful during capturing and
  79. * bubbling.
  80. */
  81. readonly attribute nsIDOMEventTarget currentTarget;
  82. /**
  83. * Used to indicate which phase of event flow is currently being
  84. * evaluated.
  85. */
  86. readonly attribute unsigned short eventPhase;
  87. /**
  88. * Used to indicate whether or not an event is a bubbling event. If the
  89. * event can bubble the value is true, else the value is false.
  90. */
  91. readonly attribute boolean bubbles;
  92. /**
  93. * Used to indicate whether or not an event can have its default action
  94. * prevented. If the default action can be prevented the value is true,
  95. * else the value is false.
  96. */
  97. readonly attribute boolean cancelable;
  98. /**
  99. * Used to specify the time (in milliseconds relative to the epoch) at
  100. * which the event was created. Due to the fact that some systems may
  101. * not provide this information the value of timeStamp may be not
  102. * available for all events. When not available, a value of 0 will be
  103. * returned. Examples of epoch time are the time of the system start or
  104. * 0:0:0 UTC 1st January 1970.
  105. */
  106. readonly attribute DOMTimeStamp timeStamp;
  107. /**
  108. * The stopPropagation method is used prevent further propagation of an
  109. * event during event flow. If this method is called by any
  110. * EventListener the event will cease propagating through the tree. The
  111. * event will complete dispatch to all listeners on the current
  112. * EventTarget before event flow stops. This method may be used during
  113. * any stage of event flow.
  114. */
  115. void stopPropagation();
  116. /**
  117. * If an event is cancelable, the preventDefault method is used to
  118. * signify that the event is to be canceled, meaning any default action
  119. * normally taken by the implementation as a result of the event will
  120. * not occur. If, during any stage of event flow, the preventDefault
  121. * method is called the event is canceled. Any default action associated
  122. * with the event will not occur. Calling this method for a
  123. * non-cancelable event has no effect. Once preventDefault has been
  124. * called it will remain in effect throughout the remainder of the
  125. * event's propagation. This method may be used during any stage of
  126. * event flow.
  127. */
  128. void preventDefault();
  129. /**
  130. * The initEvent method is used to initialize the value of an Event
  131. * created through the DocumentEvent interface. This method may only be
  132. * called before the Event has been dispatched via the dispatchEvent
  133. * method, though it may be called multiple times during that phase if
  134. * necessary. If called multiple times the final invocation takes
  135. * precedence. If called from a subclass of Event interface only the
  136. * values specified in the initEvent method are modified, all other
  137. * attributes are left unchanged.
  138. *
  139. * @param eventTypeArg Specifies the event type. This type may be
  140. * any event type currently defined in this
  141. * specification or a new event type.. The string
  142. * must be an XML name.
  143. * Any new event type must not begin with any
  144. * upper, lower, or mixed case version of the
  145. * string "DOM". This prefix is reserved for
  146. * future DOM event sets. It is also strongly
  147. * recommended that third parties adding their
  148. * own events use their own prefix to avoid
  149. * confusion and lessen the probability of
  150. * conflicts with other new events.
  151. * @param canBubbleArg Specifies whether or not the event can bubble.
  152. * @param cancelableArg Specifies whether or not the event's default
  153. * action can be prevented.
  154. */
  155. void initEvent(in DOMString eventTypeArg,
  156. in boolean canBubbleArg,
  157. in boolean cancelableArg);
  158. };