1 /* 2 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2006 Samuel Weinig <sam.weinig (at) gmail.com> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 15 * You should have received a copy of the GNU Library General Public License 16 * along with this library; see the file COPYING.LIB. If not, write to 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21 [ 22 CustomToV8 23 ] interface Element : Node { 24 25 // DOM Level 1 Core 26 27 [TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString tagName; 28 29 [TreatReturnedNullStringAs=Null] DOMString getAttribute([Default=Undefined] optional DOMString name); 30 [RaisesException, CustomElementCallbacks=Enable] void setAttribute([Default=Undefined] optional DOMString name, 31 [Default=Undefined] optional DOMString value); 32 [CustomElementCallbacks=Enable] void removeAttribute([Default=Undefined] optional DOMString name); 33 Attr getAttributeNode([Default=Undefined] optional DOMString name); 34 [RaisesException, CustomElementCallbacks=Enable] Attr setAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr newAttr); 35 [RaisesException, CustomElementCallbacks=Enable] Attr removeAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr oldAttr); 36 [PerWorldBindings] NodeList getElementsByTagName([Default=Undefined] optional DOMString name); 37 38 // For ObjC this is defined on Node for legacy support. 39 [PerWorldBindings] readonly attribute NamedNodeMap attributes; 40 boolean hasAttributes(); 41 42 // DOM Level 2 Core 43 44 DOMString getAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, 45 [Default=Undefined] optional DOMString localName); 46 [RaisesException, CustomElementCallbacks=Enable] void setAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, 47 [Default=Undefined] optional DOMString qualifiedName, 48 [Default=Undefined] optional DOMString value); 49 [CustomElementCallbacks=Enable] void removeAttributeNS([TreatNullAs=NullString] DOMString namespaceURI, 50 DOMString localName); 51 NodeList getElementsByTagNameNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, 52 [Default=Undefined] optional DOMString localName); 53 Attr getAttributeNodeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, 54 [Default=Undefined] optional DOMString localName); 55 [RaisesException, CustomElementCallbacks=Enable] Attr setAttributeNodeNS([Default=Undefined, StrictTypeChecking] optional Attr newAttr); 56 boolean hasAttribute(DOMString name); 57 boolean hasAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, 58 [Default=Undefined] optional DOMString localName); 59 60 [PerWorldBindings] readonly attribute CSSStyleDeclaration style; 61 62 // DOM4 63 // iht.com relies on id returning the empty string when no id is present. 64 // Other browsers do this as well. So we don't convert null to JS null. 65 [Reflect] attribute DOMString id; 66 67 // Common extensions 68 69 [PerWorldBindings] readonly attribute long offsetLeft; 70 [PerWorldBindings] readonly attribute long offsetTop; 71 [PerWorldBindings] readonly attribute long offsetWidth; 72 [PerWorldBindings] readonly attribute long offsetHeight; 73 [ImplementedAs=bindingsOffsetParent, PerWorldBindings] readonly attribute Element offsetParent; 74 [PerWorldBindings] readonly attribute long clientLeft; 75 [PerWorldBindings] readonly attribute long clientTop; 76 [PerWorldBindings] readonly attribute long clientWidth; 77 [PerWorldBindings] readonly attribute long clientHeight; 78 [PerWorldBindings] attribute long scrollLeft; 79 [PerWorldBindings] attribute long scrollTop; 80 [PerWorldBindings] readonly attribute long scrollWidth; 81 [PerWorldBindings] readonly attribute long scrollHeight; 82 83 void focus(); 84 void blur(); 85 void scrollIntoView(optional boolean alignWithTop); 86 87 // WebKit extensions 88 89 void scrollIntoViewIfNeeded(optional boolean centerIfNeeded); 90 void scrollByLines([Default=Undefined] optional long lines); 91 void scrollByPages([Default=Undefined] optional long pages); 92 93 // HTML 5 94 NodeList getElementsByClassName([Default=Undefined] optional DOMString name); 95 96 [Reflect=class, PerWorldBindings] attribute DOMString className; 97 [PerWorldBindings] readonly attribute DOMTokenList classList; 98 99 [PerWorldBindings] readonly attribute DOMStringMap dataset; 100 101 // NodeSelector - Selector API 102 [RaisesException] Element querySelector(DOMString selectors); 103 [RaisesException] NodeList querySelectorAll(DOMString selectors); 104 105 // WebKit extension, pending specification. 106 [RaisesException] boolean webkitMatchesSelector([Default=Undefined] optional DOMString selectors); 107 108 // Shadow DOM API 109 [EnabledAtRuntime=ShadowDOM, Reflect, PerWorldBindings] attribute DOMString pseudo; 110 [EnabledAtRuntime=ShadowDOM, RaisesException] ShadowRoot createShadowRoot(); 111 [EnabledAtRuntime=ShadowDOM, PerWorldBindings] readonly attribute ShadowRoot shadowRoot; 112 [EnabledAtRuntime=ShadowDOM, PerWorldBindings] NodeList getDestinationInsertionPoints(); 113 114 // To-be-deprecated prefixed Shadow DOM API 115 [Reflect=pseudo, ImplementedAs=pseudo, PerWorldBindings, MeasureAs=ShadowDOMPrefixedPseudo] attribute DOMString webkitPseudo; 116 [ImplementedAs=createShadowRoot, RaisesException, MeasureAs=ShadowDOMPrefixedCreateShadowRoot] ShadowRoot webkitCreateShadowRoot(); 117 [ImplementedAs=shadowRoot, PerWorldBindings, MeasureAs=ShadowDOMPrefixedShadowRoot] readonly attribute ShadowRoot webkitShadowRoot; 118 119 // CSSOM View Module API 120 ClientRectList getClientRects(); 121 ClientRect getBoundingClientRect(); 122 123 // Mozilla version 124 const unsigned short ALLOW_KEYBOARD_INPUT = 1; 125 [EnabledAtRuntime=fullscreen] void webkitRequestFullScreen([Default=Undefined] optional unsigned short flags); 126 127 // W3C version 128 [EnabledAtRuntime=fullscreen] void webkitRequestFullscreen(); 129 130 void webkitRequestPointerLock(); 131 132 // CSS Regions API 133 [EnabledAtRuntime=cssRegions, PerWorldBindings] readonly attribute DOMString webkitRegionOverset; 134 [EnabledAtRuntime=cssRegions] sequence<Range> webkitGetRegionFlowRanges(); 135 136 // Event handler DOM attributes 137 [NotEnumerable, PerWorldBindings] attribute EventHandler onabort; 138 [NotEnumerable, PerWorldBindings] attribute EventHandler onblur; 139 [NotEnumerable, PerWorldBindings] attribute EventHandler onchange; 140 [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onclick; 141 [NotEnumerable, PerWorldBindings] attribute EventHandler oncontextmenu; 142 [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondblclick; 143 [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondrag; 144 [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondragend; 145 [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondragenter; 146 [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondragleave; 147 [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondragover; 148 [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondragstart; 149 [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler ondrop; 150 [NotEnumerable, PerWorldBindings] attribute EventHandler onerror; 151 [NotEnumerable, PerWorldBindings] attribute EventHandler onfocus; 152 [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler oninput; 153 [NotEnumerable, PerWorldBindings] attribute EventHandler oninvalid; 154 [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onkeydown; 155 [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onkeypress; 156 [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onkeyup; 157 [NotEnumerable, PerWorldBindings] attribute EventHandler onload; 158 [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmousedown; 159 [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmouseenter; 160 [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmouseleave; 161 [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmousemove; 162 [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmouseout; 163 [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmouseover; 164 [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmouseup; 165 [NotEnumerable, PerWorldBindings, ActivityLog=SetterForIsolatedWorlds] attribute EventHandler onmousewheel; 166 [NotEnumerable, PerWorldBindings] attribute EventHandler onscroll; 167 [NotEnumerable, PerWorldBindings] attribute EventHandler onselect; 168 [NotEnumerable, PerWorldBindings] attribute EventHandler onsubmit; 169 170 // attribute [NotEnumerable] EventHandler oncanplay; 171 // attribute [NotEnumerable] EventHandler oncanplaythrough; 172 // attribute [NotEnumerable] EventHandler ondurationchange; 173 // attribute [NotEnumerable] EventHandler onemptied; 174 // attribute [NotEnumerable] EventHandler onended; 175 // attribute [NotEnumerable] EventHandler onloadeddata; 176 // attribute [NotEnumerable] EventHandler onloadedmetadata; 177 // attribute [NotEnumerable] EventHandler onloadstart; 178 // attribute [NotEnumerable] EventHandler onpause; 179 // attribute [NotEnumerable] EventHandler onplay; 180 // attribute [NotEnumerable] EventHandler onplaying; 181 // attribute [NotEnumerable] EventHandler onprogress; 182 // attribute [NotEnumerable] EventHandler onratechange; 183 // attribute [NotEnumerable] EventHandler onreadystatechange; 184 // attribute [NotEnumerable] EventHandler onseeked; 185 // attribute [NotEnumerable] EventHandler onseeking; 186 // attribute [NotEnumerable] EventHandler onshow; 187 // attribute [NotEnumerable] EventHandler onstalled; 188 // attribute [NotEnumerable] EventHandler onsuspend; 189 // attribute [NotEnumerable] EventHandler ontimeupdate; 190 // attribute [NotEnumerable] EventHandler onvolumechange; 191 // attribute [NotEnumerable] EventHandler onwaiting; 192 193 // WebKit extensions 194 [NotEnumerable, PerWorldBindings] attribute EventHandler onbeforecut; 195 [NotEnumerable, PerWorldBindings] attribute EventHandler oncut; 196 [NotEnumerable, PerWorldBindings] attribute EventHandler onbeforecopy; 197 [NotEnumerable, PerWorldBindings] attribute EventHandler oncopy; 198 [NotEnumerable, PerWorldBindings] attribute EventHandler onbeforepaste; 199 [NotEnumerable, PerWorldBindings] attribute EventHandler onpaste; 200 [NotEnumerable, PerWorldBindings] attribute EventHandler onreset; 201 [NotEnumerable, PerWorldBindings] attribute EventHandler onsearch; 202 [NotEnumerable, PerWorldBindings] attribute EventHandler onselectstart; 203 [NotEnumerable, EnabledAtRuntime=touch, PerWorldBindings] attribute EventHandler ontouchstart; 204 [NotEnumerable, EnabledAtRuntime=touch, PerWorldBindings] attribute EventHandler ontouchmove; 205 [NotEnumerable, EnabledAtRuntime=touch, PerWorldBindings] attribute EventHandler ontouchend; 206 [NotEnumerable, EnabledAtRuntime=touch, PerWorldBindings] attribute EventHandler ontouchcancel; 207 [NotEnumerable, PerWorldBindings] attribute EventHandler onwebkitfullscreenchange; 208 [NotEnumerable, PerWorldBindings] attribute EventHandler onwebkitfullscreenerror; 209 }; 210 211 Element implements ParentNode; 212 Element implements ChildNode; 213