| OLD | NEW |
| (Empty) |
| 1 <!doctype html> | |
| 2 <meta charset=utf-8> | |
| 3 <title>DOM IDL tests</title> | |
| 4 <script src=../../../resources/testharness.js></script> | |
| 5 <script src=../../../resources/testharnessreport.js></script> | |
| 6 <script src=../../../resources/WebIDLParser.js></script> | |
| 7 <script src=../../../resources/idlharness.js></script> | |
| 8 | |
| 9 <h1>DOM IDL tests</h1> | |
| 10 <div id=log></div> | |
| 11 | |
| 12 <script type=text/plain> | |
| 13 [Constructor(DOMString type, optional EventInit eventInitDict)/*, | |
| 14 Exposed=(Window,Worker)*/] | |
| 15 interface Event { | |
| 16 readonly attribute DOMString type; | |
| 17 readonly attribute EventTarget? target; | |
| 18 readonly attribute EventTarget? currentTarget; | |
| 19 | |
| 20 const unsigned short NONE = 0; | |
| 21 const unsigned short CAPTURING_PHASE = 1; | |
| 22 const unsigned short AT_TARGET = 2; | |
| 23 const unsigned short BUBBLING_PHASE = 3; | |
| 24 readonly attribute unsigned short eventPhase; | |
| 25 | |
| 26 void stopPropagation(); | |
| 27 void stopImmediatePropagation(); | |
| 28 | |
| 29 readonly attribute boolean bubbles; | |
| 30 readonly attribute boolean cancelable; | |
| 31 void preventDefault(); | |
| 32 readonly attribute boolean defaultPrevented; | |
| 33 | |
| 34 [Unforgeable] readonly attribute boolean isTrusted; | |
| 35 readonly attribute DOMTimeStamp timeStamp; | |
| 36 | |
| 37 void initEvent(DOMString type, boolean bubbles, boolean cancelable); | |
| 38 }; | |
| 39 | |
| 40 dictionary EventInit { | |
| 41 boolean bubbles = false; | |
| 42 boolean cancelable = false; | |
| 43 }; | |
| 44 | |
| 45 | |
| 46 [Constructor(DOMString type, optional CustomEventInit eventInitDict)/*, | |
| 47 Exposed=(Window,Worker)*/] | |
| 48 interface CustomEvent : Event { | |
| 49 readonly attribute any detail; | |
| 50 | |
| 51 void initCustomEvent(DOMString type, boolean bubbles, boolean cancelable, any
detail); | |
| 52 }; | |
| 53 | |
| 54 dictionary CustomEventInit : EventInit { | |
| 55 any detail = null; | |
| 56 }; | |
| 57 | |
| 58 | |
| 59 //[Exposed=(Window,Worker)] | |
| 60 interface EventTarget { | |
| 61 void addEventListener(DOMString type, EventListener? callback, optional (Event
ListenerOptions or boolean) options); | |
| 62 void removeEventListener(DOMString type, EventListener? callback, optional (Ev
entListenerOptions or boolean) options); | |
| 63 boolean dispatchEvent(Event event); | |
| 64 }; | |
| 65 | |
| 66 callback interface EventListener { | |
| 67 void handleEvent(Event event); | |
| 68 }; | |
| 69 | |
| 70 dictionary EventListenerOptions { | |
| 71 boolean capture; | |
| 72 boolean passive; | |
| 73 }; | |
| 74 | |
| 75 | |
| 76 [NoInterfaceObject, | |
| 77 Exposed=Window] | |
| 78 interface NonElementParentNode { | |
| 79 Element? getElementById(DOMString elementId); | |
| 80 }; | |
| 81 Document implements NonElementParentNode; | |
| 82 DocumentFragment implements NonElementParentNode; | |
| 83 | |
| 84 | |
| 85 [NoInterfaceObject, | |
| 86 Exposed=Window] | |
| 87 interface DocumentOrShadowRoot { | |
| 88 }; | |
| 89 Document implements DocumentOrShadowRoot; | |
| 90 ShadowRoot implements DocumentOrShadowRoot; | |
| 91 | |
| 92 | |
| 93 [NoInterfaceObject, | |
| 94 Exposed=Window] | |
| 95 interface ParentNode { | |
| 96 [SameObject] readonly attribute HTMLCollection children; | |
| 97 readonly attribute Element? firstElementChild; | |
| 98 readonly attribute Element? lastElementChild; | |
| 99 readonly attribute unsigned long childElementCount; | |
| 100 | |
| 101 [Unscopable] void prepend((Node or DOMString)... nodes); | |
| 102 [Unscopable] void append((Node or DOMString)... nodes); | |
| 103 | |
| 104 Element? querySelector(DOMString selectors); | |
| 105 [NewObject] NodeList querySelectorAll(DOMString selectors); | |
| 106 }; | |
| 107 Document implements ParentNode; | |
| 108 DocumentFragment implements ParentNode; | |
| 109 Element implements ParentNode; | |
| 110 | |
| 111 | |
| 112 [NoInterfaceObject, | |
| 113 Exposed=Window] | |
| 114 interface NonDocumentTypeChildNode { | |
| 115 readonly attribute Element? previousElementSibling; | |
| 116 readonly attribute Element? nextElementSibling; | |
| 117 }; | |
| 118 Element implements NonDocumentTypeChildNode; | |
| 119 CharacterData implements NonDocumentTypeChildNode; | |
| 120 | |
| 121 | |
| 122 [NoInterfaceObject, | |
| 123 Exposed=Window] | |
| 124 interface ChildNode { | |
| 125 [Unscopable] void before((Node or DOMString)... nodes); | |
| 126 [Unscopable] void after((Node or DOMString)... nodes); | |
| 127 [Unscopable] void replaceWith((Node or DOMString)... nodes); | |
| 128 [Unscopable] void remove(); | |
| 129 }; | |
| 130 DocumentType implements ChildNode; | |
| 131 Element implements ChildNode; | |
| 132 CharacterData implements ChildNode; | |
| 133 | |
| 134 | |
| 135 [NoInterfaceObject, | |
| 136 Exposed=Window] | |
| 137 interface Slotable { | |
| 138 readonly attribute HTMLSlotElement? assignedSlot; | |
| 139 }; | |
| 140 Element implements Slotable; | |
| 141 Text implements Slotable; | |
| 142 | |
| 143 | |
| 144 [Exposed=Window] | |
| 145 interface NodeList { | |
| 146 getter Node? item(unsigned long index); | |
| 147 readonly attribute unsigned long length; | |
| 148 // iterable<Node>; | |
| 149 }; | |
| 150 | |
| 151 | |
| 152 [Exposed=Window, LegacyUnenumerableNamedProperties] | |
| 153 interface HTMLCollection { | |
| 154 readonly attribute unsigned long length; | |
| 155 getter Element? item(unsigned long index); | |
| 156 getter Element? namedItem(DOMString name); | |
| 157 }; | |
| 158 | |
| 159 | |
| 160 [Constructor(MutationCallback callback)] | |
| 161 interface MutationObserver { | |
| 162 void observe(Node target, MutationObserverInit options); | |
| 163 void disconnect(); | |
| 164 sequence<MutationRecord> takeRecords(); | |
| 165 }; | |
| 166 | |
| 167 callback MutationCallback = void (sequence<MutationRecord> mutations, MutationOb
server observer); | |
| 168 | |
| 169 dictionary MutationObserverInit { | |
| 170 boolean childList = false; | |
| 171 boolean attributes; | |
| 172 boolean characterData; | |
| 173 boolean subtree = false; | |
| 174 boolean attributeOldValue; | |
| 175 boolean characterDataOldValue; | |
| 176 sequence<DOMString> attributeFilter; | |
| 177 }; | |
| 178 | |
| 179 | |
| 180 [Exposed=Window] | |
| 181 interface MutationRecord { | |
| 182 readonly attribute DOMString type; | |
| 183 [SameObject] readonly attribute Node target; | |
| 184 [SameObject] readonly attribute NodeList addedNodes; | |
| 185 [SameObject] readonly attribute NodeList removedNodes; | |
| 186 readonly attribute Node? previousSibling; | |
| 187 readonly attribute Node? nextSibling; | |
| 188 readonly attribute DOMString? attributeName; | |
| 189 readonly attribute DOMString? attributeNamespace; | |
| 190 readonly attribute DOMString? oldValue; | |
| 191 }; | |
| 192 | |
| 193 | |
| 194 [Exposed=Window] | |
| 195 interface Node : EventTarget { | |
| 196 const unsigned short ELEMENT_NODE = 1; | |
| 197 const unsigned short ATTRIBUTE_NODE = 2; // historical | |
| 198 const unsigned short TEXT_NODE = 3; | |
| 199 const unsigned short CDATA_SECTION_NODE = 4; // historical | |
| 200 const unsigned short ENTITY_REFERENCE_NODE = 5; // historical | |
| 201 const unsigned short ENTITY_NODE = 6; // historical | |
| 202 const unsigned short PROCESSING_INSTRUCTION_NODE = 7; | |
| 203 const unsigned short COMMENT_NODE = 8; | |
| 204 const unsigned short DOCUMENT_NODE = 9; | |
| 205 const unsigned short DOCUMENT_TYPE_NODE = 10; | |
| 206 const unsigned short DOCUMENT_FRAGMENT_NODE = 11; | |
| 207 const unsigned short NOTATION_NODE = 12; // historical | |
| 208 readonly attribute unsigned short nodeType; | |
| 209 readonly attribute DOMString nodeName; | |
| 210 | |
| 211 readonly attribute DOMString baseURI; | |
| 212 | |
| 213 readonly attribute boolean isConnected; | |
| 214 readonly attribute Document? ownerDocument; | |
| 215 readonly attribute Node rootNode; | |
| 216 readonly attribute Node? parentNode; | |
| 217 readonly attribute Element? parentElement; | |
| 218 boolean hasChildNodes(); | |
| 219 [SameObject] readonly attribute NodeList childNodes; | |
| 220 readonly attribute Node? firstChild; | |
| 221 readonly attribute Node? lastChild; | |
| 222 readonly attribute Node? previousSibling; | |
| 223 readonly attribute Node? nextSibling; | |
| 224 | |
| 225 attribute DOMString? nodeValue; | |
| 226 attribute DOMString? textContent; | |
| 227 void normalize(); | |
| 228 | |
| 229 [NewObject] Node cloneNode(optional boolean deep = false); | |
| 230 boolean isEqualNode(Node? otherNode); | |
| 231 boolean isSameNode(Node? otherNode); // historical alias of === | |
| 232 | |
| 233 const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01; | |
| 234 const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02; | |
| 235 const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04; | |
| 236 const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08; | |
| 237 const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10; | |
| 238 const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; | |
| 239 unsigned short compareDocumentPosition(Node other); | |
| 240 boolean contains(Node? other); | |
| 241 | |
| 242 DOMString? lookupPrefix(DOMString? namespace); | |
| 243 DOMString? lookupNamespaceURI(DOMString? prefix); | |
| 244 boolean isDefaultNamespace(DOMString? namespace); | |
| 245 | |
| 246 Node insertBefore(Node node, Node? child); | |
| 247 Node appendChild(Node node); | |
| 248 Node replaceChild(Node node, Node child); | |
| 249 Node removeChild(Node child); | |
| 250 }; | |
| 251 | |
| 252 | |
| 253 [Constructor, | |
| 254 Exposed=Window] | |
| 255 interface Document : Node { | |
| 256 [SameObject] readonly attribute DOMImplementation implementation; | |
| 257 readonly attribute DOMString URL; | |
| 258 readonly attribute DOMString documentURI; | |
| 259 readonly attribute DOMString origin; | |
| 260 readonly attribute DOMString compatMode; | |
| 261 readonly attribute DOMString characterSet; | |
| 262 readonly attribute DOMString charset; // historical alias of .characterSet | |
| 263 readonly attribute DOMString inputEncoding; // historical alias of .characterS
et | |
| 264 readonly attribute DOMString contentType; | |
| 265 | |
| 266 readonly attribute DocumentType? doctype; | |
| 267 readonly attribute Element? documentElement; | |
| 268 HTMLCollection getElementsByTagName(DOMString qualifiedName); | |
| 269 HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localNam
e); | |
| 270 HTMLCollection getElementsByClassName(DOMString classNames); | |
| 271 | |
| 272 [NewObject] Element createElement(DOMString localName, optional ElementCreatio
nOptions options); | |
| 273 [NewObject] Element createElementNS(DOMString? namespace, DOMString qualifiedN
ame, optional ElementCreationOptions options); | |
| 274 [NewObject] DocumentFragment createDocumentFragment(); | |
| 275 [NewObject] Text createTextNode(DOMString data); | |
| 276 [NewObject] Comment createComment(DOMString data); | |
| 277 [NewObject] ProcessingInstruction createProcessingInstruction(DOMString target
, DOMString data); | |
| 278 | |
| 279 [NewObject] Node importNode(Node node, optional boolean deep = false); | |
| 280 Node adoptNode(Node node); | |
| 281 | |
| 282 [NewObject] Attr createAttribute(DOMString localName); | |
| 283 [NewObject] Attr createAttributeNS(DOMString? namespace, DOMString qualifiedNa
me); | |
| 284 | |
| 285 [NewObject] Event createEvent(DOMString interface); | |
| 286 | |
| 287 [NewObject] Range createRange(); | |
| 288 | |
| 289 // NodeFilter.SHOW_ALL = 0xFFFFFFFF | |
| 290 [NewObject] NodeIterator createNodeIterator(Node root, optional unsigned long
whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null); | |
| 291 [NewObject] TreeWalker createTreeWalker(Node root, optional unsigned long what
ToShow = 0xFFFFFFFF, optional NodeFilter? filter = null); | |
| 292 }; | |
| 293 | |
| 294 [Exposed=Window] | |
| 295 interface XMLDocument : Document {}; | |
| 296 | |
| 297 dictionary ElementCreationOptions { | |
| 298 DOMString is; | |
| 299 }; | |
| 300 | |
| 301 | |
| 302 [Exposed=Window] | |
| 303 interface DOMImplementation { | |
| 304 [NewObject] DocumentType createDocumentType(DOMString qualifiedName, DOMString
publicId, DOMString systemId); | |
| 305 [NewObject] XMLDocument createDocument(DOMString? namespace, [TreatNullAs=Empt
yString] DOMString qualifiedName, optional DocumentType? doctype = null); | |
| 306 [NewObject] Document createHTMLDocument(optional DOMString title); | |
| 307 | |
| 308 boolean hasFeature(); // useless; always returns true | |
| 309 }; | |
| 310 | |
| 311 | |
| 312 [Exposed=Window] | |
| 313 interface DocumentType : Node { | |
| 314 readonly attribute DOMString name; | |
| 315 readonly attribute DOMString publicId; | |
| 316 readonly attribute DOMString systemId; | |
| 317 }; | |
| 318 | |
| 319 | |
| 320 [Constructor, | |
| 321 Exposed=Window] | |
| 322 interface DocumentFragment : Node { | |
| 323 }; | |
| 324 | |
| 325 | |
| 326 [Exposed=Window] | |
| 327 interface ShadowRoot : DocumentFragment { | |
| 328 readonly attribute ShadowRootMode mode; | |
| 329 readonly attribute Element host; | |
| 330 }; | |
| 331 | |
| 332 enum ShadowRootMode { "open", "closed" }; | |
| 333 | |
| 334 | |
| 335 [Exposed=Window] | |
| 336 interface Element : Node { | |
| 337 readonly attribute DOMString? namespaceURI; | |
| 338 readonly attribute DOMString? prefix; | |
| 339 readonly attribute DOMString localName; | |
| 340 readonly attribute DOMString tagName; | |
| 341 | |
| 342 attribute DOMString id; | |
| 343 attribute DOMString className; | |
| 344 [SameObject, PutForwards=value] readonly attribute DOMTokenList classList; | |
| 345 attribute DOMString slot; | |
| 346 | |
| 347 boolean hasAttributes(); | |
| 348 [SameObject] readonly attribute NamedNodeMap attributes; | |
| 349 sequence<DOMString> getAttributeNames(); | |
| 350 DOMString? getAttribute(DOMString qualifiedName); | |
| 351 DOMString? getAttributeNS(DOMString? namespace, DOMString localName); | |
| 352 void setAttribute(DOMString qualifiedName, DOMString value); | |
| 353 void setAttributeNS(DOMString? namespace, DOMString qualifiedName, DOMString v
alue); | |
| 354 void removeAttribute(DOMString qualifiedName); | |
| 355 void removeAttributeNS(DOMString? namespace, DOMString localName); | |
| 356 boolean hasAttribute(DOMString qualifiedName); | |
| 357 boolean hasAttributeNS(DOMString? namespace, DOMString localName); | |
| 358 | |
| 359 Attr? getAttributeNode(DOMString qualifiedName); | |
| 360 Attr? getAttributeNodeNS(DOMString? namespace, DOMString localName); | |
| 361 Attr? setAttributeNode(Attr attr); | |
| 362 Attr? setAttributeNodeNS(Attr attr); | |
| 363 Attr removeAttributeNode(Attr attr); | |
| 364 | |
| 365 ShadowRoot attachShadow(ShadowRootInit init); | |
| 366 readonly attribute ShadowRoot? shadowRoot; | |
| 367 | |
| 368 Element? closest(DOMString selectors); | |
| 369 boolean matches(DOMString selectors); | |
| 370 boolean webkitMatchesSelector(DOMString selectors); // historical alias of .ma
tches | |
| 371 | |
| 372 HTMLCollection getElementsByTagName(DOMString qualifiedName); | |
| 373 HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localNam
e); | |
| 374 HTMLCollection getElementsByClassName(DOMString classNames); | |
| 375 | |
| 376 Element? insertAdjacentElement(DOMString where, Element element); // historica
l | |
| 377 void insertAdjacentText(DOMString where, DOMString data); // historical | |
| 378 }; | |
| 379 | |
| 380 dictionary ShadowRootInit { | |
| 381 // required ShadowRootMode mode; | |
| 382 }; | |
| 383 | |
| 384 | |
| 385 [Exposed=Window, LegacyUnenumerableNamedProperties] | |
| 386 interface NamedNodeMap { | |
| 387 readonly attribute unsigned long length; | |
| 388 getter Attr? item(unsigned long index); | |
| 389 getter Attr? getNamedItem(DOMString qualifiedName); | |
| 390 Attr? getNamedItemNS(DOMString? namespace, DOMString localName); | |
| 391 Attr? setNamedItem(Attr attr); | |
| 392 Attr? setNamedItemNS(Attr attr); | |
| 393 Attr removeNamedItem(DOMString qualifiedName); | |
| 394 Attr removeNamedItemNS(DOMString? namespace, DOMString localName); | |
| 395 }; | |
| 396 | |
| 397 | |
| 398 [Exposed=Window] | |
| 399 interface Attr { | |
| 400 readonly attribute DOMString? namespaceURI; | |
| 401 readonly attribute DOMString? prefix; | |
| 402 readonly attribute DOMString localName; | |
| 403 readonly attribute DOMString name; | |
| 404 readonly attribute DOMString nodeName; // historical alias of .name | |
| 405 attribute DOMString value; | |
| 406 [TreatNullAs=EmptyString] attribute DOMString nodeValue; // historical alias o
f .value | |
| 407 [TreatNullAs=EmptyString] attribute DOMString textContent; // historical alias
of .value | |
| 408 | |
| 409 readonly attribute Element? ownerElement; | |
| 410 | |
| 411 readonly attribute boolean specified; // useless; always returns true | |
| 412 }; | |
| 413 | |
| 414 [Exposed=Window] | |
| 415 interface CharacterData : Node { | |
| 416 [TreatNullAs=EmptyString] attribute DOMString data; | |
| 417 readonly attribute unsigned long length; | |
| 418 DOMString substringData(unsigned long offset, unsigned long count); | |
| 419 void appendData(DOMString data); | |
| 420 void insertData(unsigned long offset, DOMString data); | |
| 421 void deleteData(unsigned long offset, unsigned long count); | |
| 422 void replaceData(unsigned long offset, unsigned long count, DOMString data); | |
| 423 }; | |
| 424 | |
| 425 | |
| 426 [Constructor(optional DOMString data = ""), | |
| 427 Exposed=Window] | |
| 428 interface Text : CharacterData { | |
| 429 [NewObject] Text splitText(unsigned long offset); | |
| 430 readonly attribute DOMString wholeText; | |
| 431 }; | |
| 432 | |
| 433 [Exposed=Window] | |
| 434 interface ProcessingInstruction : CharacterData { | |
| 435 readonly attribute DOMString target; | |
| 436 }; | |
| 437 | |
| 438 [Constructor(optional DOMString data = ""), | |
| 439 Exposed=Window] | |
| 440 interface Comment : CharacterData { | |
| 441 }; | |
| 442 | |
| 443 | |
| 444 [Constructor, | |
| 445 Exposed=Window] | |
| 446 interface Range { | |
| 447 readonly attribute Node startContainer; | |
| 448 readonly attribute unsigned long startOffset; | |
| 449 readonly attribute Node endContainer; | |
| 450 readonly attribute unsigned long endOffset; | |
| 451 readonly attribute boolean collapsed; | |
| 452 readonly attribute Node commonAncestorContainer; | |
| 453 | |
| 454 void setStart(Node node, unsigned long offset); | |
| 455 void setEnd(Node node, unsigned long offset); | |
| 456 void setStartBefore(Node node); | |
| 457 void setStartAfter(Node node); | |
| 458 void setEndBefore(Node node); | |
| 459 void setEndAfter(Node node); | |
| 460 void collapse(optional boolean toStart = false); | |
| 461 void selectNode(Node node); | |
| 462 void selectNodeContents(Node node); | |
| 463 | |
| 464 const unsigned short START_TO_START = 0; | |
| 465 const unsigned short START_TO_END = 1; | |
| 466 const unsigned short END_TO_END = 2; | |
| 467 const unsigned short END_TO_START = 3; | |
| 468 short compareBoundaryPoints(unsigned short how, Range sourceRange); | |
| 469 | |
| 470 void deleteContents(); | |
| 471 [NewObject] DocumentFragment extractContents(); | |
| 472 [NewObject] DocumentFragment cloneContents(); | |
| 473 void insertNode(Node node); | |
| 474 void surroundContents(Node newParent); | |
| 475 | |
| 476 [NewObject] Range cloneRange(); | |
| 477 void detach(); | |
| 478 | |
| 479 boolean isPointInRange(Node node, unsigned long offset); | |
| 480 short comparePoint(Node node, unsigned long offset); | |
| 481 | |
| 482 boolean intersectsNode(Node node); | |
| 483 | |
| 484 stringifier; | |
| 485 }; | |
| 486 | |
| 487 | |
| 488 [Exposed=Window] | |
| 489 interface NodeIterator { | |
| 490 [SameObject] readonly attribute Node root; | |
| 491 readonly attribute Node referenceNode; | |
| 492 readonly attribute boolean pointerBeforeReferenceNode; | |
| 493 readonly attribute unsigned long whatToShow; | |
| 494 readonly attribute NodeFilter? filter; | |
| 495 | |
| 496 Node? nextNode(); | |
| 497 Node? previousNode(); | |
| 498 | |
| 499 void detach(); | |
| 500 }; | |
| 501 | |
| 502 | |
| 503 [Exposed=Window] | |
| 504 interface TreeWalker { | |
| 505 [SameObject] readonly attribute Node root; | |
| 506 readonly attribute unsigned long whatToShow; | |
| 507 readonly attribute NodeFilter? filter; | |
| 508 attribute Node currentNode; | |
| 509 | |
| 510 Node? parentNode(); | |
| 511 Node? firstChild(); | |
| 512 Node? lastChild(); | |
| 513 Node? previousSibling(); | |
| 514 Node? nextSibling(); | |
| 515 Node? previousNode(); | |
| 516 Node? nextNode(); | |
| 517 }; | |
| 518 | |
| 519 [Exposed=Window] | |
| 520 callback interface NodeFilter { | |
| 521 // Constants for acceptNode() | |
| 522 const unsigned short FILTER_ACCEPT = 1; | |
| 523 const unsigned short FILTER_REJECT = 2; | |
| 524 const unsigned short FILTER_SKIP = 3; | |
| 525 | |
| 526 // Constants for whatToShow | |
| 527 const unsigned long SHOW_ALL = 0xFFFFFFFF; | |
| 528 const unsigned long SHOW_ELEMENT = 0x1; | |
| 529 const unsigned long SHOW_ATTRIBUTE = 0x2; // historical | |
| 530 const unsigned long SHOW_TEXT = 0x4; | |
| 531 const unsigned long SHOW_CDATA_SECTION = 0x8; // historical | |
| 532 const unsigned long SHOW_ENTITY_REFERENCE = 0x10; // historical | |
| 533 const unsigned long SHOW_ENTITY = 0x20; // historical | |
| 534 const unsigned long SHOW_PROCESSING_INSTRUCTION = 0x40; | |
| 535 const unsigned long SHOW_COMMENT = 0x80; | |
| 536 const unsigned long SHOW_DOCUMENT = 0x100; | |
| 537 const unsigned long SHOW_DOCUMENT_TYPE = 0x200; | |
| 538 const unsigned long SHOW_DOCUMENT_FRAGMENT = 0x400; | |
| 539 const unsigned long SHOW_NOTATION = 0x800; // historical | |
| 540 | |
| 541 unsigned short acceptNode(Node node); | |
| 542 }; | |
| 543 | |
| 544 | |
| 545 interface DOMTokenList { | |
| 546 readonly attribute unsigned long length; | |
| 547 getter DOMString? item(unsigned long index); | |
| 548 boolean contains(DOMString token); | |
| 549 void add(DOMString... tokens); | |
| 550 void remove(DOMString... tokens); | |
| 551 boolean toggle(DOMString token, optional boolean force); | |
| 552 void replace(DOMString token, DOMString newToken); | |
| 553 boolean supports(DOMString token); | |
| 554 attribute DOMString value; | |
| 555 stringifier; | |
| 556 // iterable<DOMString>; | |
| 557 }; | |
| 558 </script> | |
| 559 <script> | |
| 560 "use strict"; | |
| 561 var xmlDoc, detachedRange, element; | |
| 562 var idlArray; | |
| 563 setup(function() { | |
| 564 xmlDoc = document.implementation.createDocument(null, "", null); | |
| 565 detachedRange = document.createRange(); | |
| 566 detachedRange.detach(); | |
| 567 element = xmlDoc.createElementNS(null, "test"); | |
| 568 element.setAttribute("bar", "baz"); | |
| 569 | |
| 570 idlArray = new IdlArray(); | |
| 571 idlArray.add_idls(document.querySelector("script[type=text\\/plain]").textCont
ent); | |
| 572 idlArray.add_objects({ | |
| 573 Event: ['document.createEvent("Event")', 'new Event("foo")'], | |
| 574 CustomEvent: ['new CustomEvent("foo")'], | |
| 575 Document: ['new Document()'], | |
| 576 XMLDocument: ['xmlDoc'], | |
| 577 DOMImplementation: ['document.implementation'], | |
| 578 DocumentFragment: ['document.createDocumentFragment()'], | |
| 579 DocumentType: ['document.doctype'], | |
| 580 Element: ['element'], | |
| 581 Attr: ['document.querySelector("[id]").attributes[0]'], | |
| 582 Text: ['document.createTextNode("abc")'], | |
| 583 ProcessingInstruction: ['xmlDoc.createProcessingInstruction("abc", "def")'], | |
| 584 Comment: ['document.createComment("abc")'], | |
| 585 Range: ['document.createRange()', 'detachedRange'], | |
| 586 NodeIterator: ['document.createNodeIterator(document.body, NodeFilter.SHOW_A
LL, null, false)'], | |
| 587 TreeWalker: ['document.createTreeWalker(document.body, NodeFilter.SHOW_ALL,
null, false)'], | |
| 588 NodeList: ['document.querySelectorAll("script")'], | |
| 589 HTMLCollection: ['document.body.children'], | |
| 590 DOMTokenList: ['document.body.classList'], | |
| 591 }); | |
| 592 }); | |
| 593 idlArray.test(); | |
| 594 </script> | |
| OLD | NEW |