1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
6 * The origin of this IDL file is
7 * http://www.w3.org/TR/2012/WD-dom-20120105/
9 * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
10 * liability, trademark and document use rules apply.
15 interface UserDataHandler;
17 interface Node : EventTarget {
18 const unsigned short ELEMENT_NODE = 1;
19 const unsigned short ATTRIBUTE_NODE = 2; // historical
20 const unsigned short TEXT_NODE = 3;
21 const unsigned short CDATA_SECTION_NODE = 4; // historical
22 const unsigned short ENTITY_REFERENCE_NODE = 5; // historical
23 const unsigned short ENTITY_NODE = 6; // historical
24 const unsigned short PROCESSING_INSTRUCTION_NODE = 7;
25 const unsigned short COMMENT_NODE = 8;
26 const unsigned short DOCUMENT_NODE = 9;
27 const unsigned short DOCUMENT_TYPE_NODE = 10;
28 const unsigned short DOCUMENT_FRAGMENT_NODE = 11;
29 const unsigned short NOTATION_NODE = 12; // historical
31 readonly attribute unsigned short nodeType;
33 readonly attribute DOMString nodeName;
36 readonly attribute DOMString? baseURI;
39 readonly attribute Document? ownerDocument;
41 readonly attribute Node? parentNode;
43 readonly attribute Element? parentElement;
45 boolean hasChildNodes();
47 readonly attribute NodeList childNodes;
49 readonly attribute Node? firstChild;
51 readonly attribute Node? lastChild;
53 readonly attribute Node? previousSibling;
55 readonly attribute Node? nextSibling;
58 attribute DOMString? nodeValue;
60 attribute DOMString? textContent;
62 Node insertBefore(Node node, Node? child);
64 Node appendChild(Node node);
66 Node replaceChild(Node node, Node child);
68 Node removeChild(Node child);
72 Node cloneNode(optional boolean deep = false);
74 boolean isEqualNode(Node? node);
76 const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01;
77 const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02;
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; // historical
83 unsigned short compareDocumentPosition(Node other);
85 boolean contains(Node? other);
88 DOMString? lookupPrefix(DOMString? namespace);
90 DOMString? lookupNamespaceURI(DOMString? prefix);
92 boolean isDefaultNamespace(DOMString? namespace);
94 // Mozilla-specific stuff
95 // These have been moved to Element in the spec.
96 // If we move namespaceURI, prefix and localName to Element they should return
97 // a non-nullable type.
99 readonly attribute DOMString? namespaceURI;
101 readonly attribute DOMString? prefix;
103 readonly attribute DOMString? localName;
106 boolean hasAttributes();
107 [Throws, Func="IsChromeOrXBL"]
108 any setUserData(DOMString key, any data, UserDataHandler? handler);
109 [Throws, Func="IsChromeOrXBL"]
110 any getUserData(DOMString key);
112 readonly attribute Principal nodePrincipal;
114 readonly attribute URI? baseURIObject;
116 sequence<MutationObserver> getBoundMutationObservers();