OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> | 3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
14 * | 14 * |
15 * You should have received a copy of the GNU Library General Public License | 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 | 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, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
19 */ | 19 */ |
20 | 20 |
| 21 // https://dom.spec.whatwg.org/#interface-node |
| 22 |
21 [ | 23 [ |
22 DependentLifetime, | 24 DependentLifetime, |
23 ] interface Node : EventTarget { | 25 ] interface Node : EventTarget { |
24 // NodeType | 26 const unsigned short ELEMENT_NODE = 1; |
25 const unsigned short ELEMENT_NODE = 1; | 27 // FIXME: Attr should not inherit from Node. crbug.com/305105 |
26 const unsigned short ATTRIBUTE_NODE = 2; | 28 const unsigned short ATTRIBUTE_NODE = 2; |
27 const unsigned short TEXT_NODE = 3; | 29 const unsigned short TEXT_NODE = 3; |
28 const unsigned short CDATA_SECTION_NODE = 4; | 30 // FIXME: CDATASection has been removed from the spec. crbug.com/437205 |
29 const unsigned short ENTITY_REFERENCE_NODE = 5; // EntityRefer
ence nodes are impossible to create in WebKit. | 31 const unsigned short CDATA_SECTION_NODE = 4; |
30 const unsigned short ENTITY_NODE = 6; | 32 const unsigned short ENTITY_REFERENCE_NODE = 5; // historical |
31 const unsigned short PROCESSING_INSTRUCTION_NODE = 7; | 33 const unsigned short ENTITY_NODE = 6; // historical |
32 const unsigned short COMMENT_NODE = 8; | 34 const unsigned short PROCESSING_INSTRUCTION_NODE = 7; |
33 const unsigned short DOCUMENT_NODE = 9; | 35 const unsigned short COMMENT_NODE = 8; |
34 const unsigned short DOCUMENT_TYPE_NODE = 10; | 36 const unsigned short DOCUMENT_NODE = 9; |
35 const unsigned short DOCUMENT_FRAGMENT_NODE = 11; | 37 const unsigned short DOCUMENT_TYPE_NODE = 10; |
36 const unsigned short NOTATION_NODE = 12; | 38 const unsigned short DOCUMENT_FRAGMENT_NODE = 11; |
37 | 39 const unsigned short NOTATION_NODE = 12; // historical |
| 40 readonly attribute unsigned short nodeType; |
38 readonly attribute DOMString nodeName; | 41 readonly attribute DOMString nodeName; |
39 | 42 |
| 43 [ExposeJSAccessors] readonly attribute DOMString? baseURI; |
| 44 |
| 45 [PerWorldBindings, ExposeJSAccessors] readonly attribute Document? ownerDocu
ment; |
| 46 [PerWorldBindings, ExposeJSAccessors] readonly attribute Node? parentNode; |
| 47 [PerWorldBindings] readonly attribute Element? parentElement; |
| 48 [ImplementedAs=hasChildren] boolean hasChildNodes(); |
| 49 [PerWorldBindings, ExposeJSAccessors] readonly attribute NodeList childNodes
; |
| 50 [PerWorldBindings, ExposeJSAccessors] readonly attribute Node? firstChild; |
| 51 [PerWorldBindings, ExposeJSAccessors] readonly attribute Node? lastChild; |
| 52 [PerWorldBindings, ExposeJSAccessors] readonly attribute Node? previousSibli
ng; |
| 53 [PerWorldBindings, ExposeJSAccessors] readonly attribute Node? nextSibling; |
| 54 |
40 [CustomElementCallbacks] attribute DOMString? nodeValue; | 55 [CustomElementCallbacks] attribute DOMString? nodeValue; |
41 | 56 // FIXME: textContent should not have [TreatUndefinedAs=NullString]. |
42 readonly attribute unsigned short nodeType; | 57 [TreatUndefinedAs=NullString, CustomElementCallbacks] attribute DOMString? t
extContent; |
43 [PerWorldBindings, ExposeJSAccessors] readonly attribute Node pa
rentNode; | |
44 [PerWorldBindings, ExposeJSAccessors] readonly attribute NodeList ch
ildNodes; | |
45 [PerWorldBindings, ExposeJSAccessors] readonly attribute Node fi
rstChild; | |
46 [PerWorldBindings, ExposeJSAccessors] readonly attribute Node la
stChild; | |
47 [PerWorldBindings, ExposeJSAccessors] readonly attribute Node pr
eviousSibling; | |
48 [PerWorldBindings, ExposeJSAccessors] readonly attribute Node ne
xtSibling; | |
49 [PerWorldBindings, ExposeJSAccessors] readonly attribute Document ow
nerDocument; | |
50 | |
51 [CustomElementCallbacks, PerWorldBindings, RaisesException, TypeChecking=Int
erface] Node insertBefore(Node newChild, Node? refChild); | |
52 [CustomElementCallbacks, PerWorldBindings, RaisesException, TypeChecking=Int
erface] Node replaceChild(Node newChild, Node oldChild); | |
53 [CustomElementCallbacks, RaisesException, TypeChecking=Interface] Node remov
eChild(Node oldChild); | |
54 [CustomElementCallbacks, PerWorldBindings, RaisesException, TypeChecking=Int
erface] Node appendChild(Node newChild); | |
55 | |
56 [ImplementedAs=hasChildren] boolean hasChildNodes(); | |
57 [CustomElementCallbacks] Node cloneNode(optional boolean deep); | |
58 [CustomElementCallbacks] void normalize(); | 58 [CustomElementCallbacks] void normalize(); |
59 | 59 |
60 // Introduced in DOM Level 2: | 60 // FIXME: The deep argument should have a default value false. |
61 [MeasureAs=NodeNamespaceURI] readonly attribute DOMString? namespaceURI; //
Moved to Element and Attr in DOM4. | 61 [CustomElementCallbacks] Node cloneNode(optional boolean deep); |
62 [MeasureAs=NodeLocalName] readonly attribute DOMString? localName; // Moved
to Element and Attr in DOM4. | 62 boolean isEqualNode(Node? node); |
63 | 63 |
64 // Introduced in DOM Level 3: | 64 const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01; |
65 [ExposeJSAccessors] readonly attribute DOMString? baseURI; | 65 const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02; |
| 66 const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04; |
| 67 const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08; |
| 68 const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10; |
| 69 const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; |
| 70 unsigned short compareDocumentPosition(Node other); |
| 71 boolean contains(Node? other); |
66 | 72 |
67 [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, TreatUndefinedAs=Nu
llString, CustomElementCallbacks] attribute DOMString textContent; | 73 DOMString? lookupPrefix(DOMString? namespaceURI); |
| 74 DOMString? lookupNamespaceURI(DOMString? prefix); |
| 75 boolean isDefaultNamespace(DOMString? namespaceURI); |
68 | 76 |
69 [MeasureAs=NodeIsSameNode] boolean isSameNode([Default=Undefined] optional N
ode other); // Removed in DOM4. | 77 [CustomElementCallbacks, PerWorldBindings, RaisesException, TypeChecking=Int
erface] Node insertBefore(Node node, Node? child); |
70 boolean isEqualNode(Node other); | 78 [CustomElementCallbacks, PerWorldBindings, RaisesException, TypeChecking=Int
erface] Node appendChild(Node node); |
71 DOMString? lookupPrefix(DOMString? namespaceURI); | 79 [CustomElementCallbacks, PerWorldBindings, RaisesException, TypeChecking=Int
erface] Node replaceChild(Node node, Node child); |
72 boolean isDefaultNamespace(DOMString? namespaceURI); | 80 [CustomElementCallbacks, RaisesException, TypeChecking=Interface] Node remov
eChild(Node child); |
73 DOMString? lookupNamespaceURI(DOMString? prefix); | |
74 | 81 |
75 // DocumentPosition | 82 // FIXME: namespaceURI and localName have been moved to Element and Attr. |
76 const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01; | 83 [MeasureAs=NodeNamespaceURI] readonly attribute DOMString? namespaceURI; |
77 const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02; | 84 [MeasureAs=NodeLocalName] readonly attribute DOMString? localName; |
78 const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04; | |
79 const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08; | |
80 const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10; | |
81 const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; | |
82 | 85 |
83 unsigned short compareDocumentPosition(Node other); | 86 // FIXME: isSameNode has been removed from the spec: |
84 | 87 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=27424 |
85 // Introduced in DOM4 | 88 [MeasureAs=NodeIsSameNode] boolean isSameNode([Default=Undefined] optional N
ode other); |
86 boolean contains(Node other); | |
87 | |
88 // IE extensions | |
89 [PerWorldBindings] readonly attribute Element parentElement; | |
90 }; | 89 }; |
OLD | NEW |