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.
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;
35 [Pure, Throws, NeedsCallerType, BinaryName="baseURIFromJS"]
36 readonly attribute DOMString? baseURI;
38 [Pure, BinaryName=isInComposedDoc]
39 readonly attribute boolean isConnected;
41 readonly attribute Document? ownerDocument;
43 Node getRootNode(optional GetRootNodeOptions options = {});
45 readonly attribute Node? parentNode;
47 readonly attribute Element? parentElement;
49 boolean hasChildNodes();
51 readonly attribute NodeList childNodes;
53 readonly attribute Node? firstChild;
55 readonly attribute Node? lastChild;
57 readonly attribute Node? previousSibling;
59 readonly attribute Node? nextSibling;
61 [CEReactions, SetterThrows, Pure]
62 attribute DOMString? nodeValue;
63 [CEReactions, SetterThrows, GetterCanOOM,
64 SetterNeedsSubjectPrincipal=NonSystem, Pure]
65 attribute DOMString? textContent;
66 // These DOM methods cannot be accessed by UA Widget scripts
67 // because the DOM element reflectors will be in the content scope,
68 // instead of the desired UA Widget scope.
69 [CEReactions, Throws, Func="IsNotUAWidget"]
70 Node insertBefore(Node node, Node? child);
71 [CEReactions, Throws, Func="IsNotUAWidget"]
72 Node appendChild(Node node);
73 [CEReactions, Throws, Func="IsNotUAWidget"]
74 Node replaceChild(Node node, Node child);
76 Node removeChild(Node child);
80 [CEReactions, Throws, Func="IsNotUAWidget"]
81 Node cloneNode(optional boolean deep = false);
83 boolean isSameNode(Node? node);
85 boolean isEqualNode(Node? node);
87 const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01;
88 const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02;
89 const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04;
90 const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08;
91 const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10;
92 const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; // historical
94 unsigned short compareDocumentPosition(Node other);
96 boolean contains(Node? other);
99 DOMString? lookupPrefix(DOMString? namespace);
101 DOMString? lookupNamespaceURI(DOMString? prefix);
103 boolean isDefaultNamespace(DOMString? namespace);
105 // Mozilla-specific stuff
107 readonly attribute Principal nodePrincipal;
109 readonly attribute URI? baseURIObject;
111 DOMString generateXPath();
112 [ChromeOnly, Pure, BinaryName="flattenedTreeParentNodeNonInline"]
113 readonly attribute Node? flattenedTreeParentNode;
114 [ChromeOnly, Pure, BinaryName="isInNativeAnonymousSubtree"]
115 readonly attribute boolean isNativeAnonymous;
117 // Maybe this would be useful to authors? https://github.com/whatwg/dom/issues/826
118 [Func="IsChromeOrUAWidget", Pure, BinaryName="containingShadow"]
119 readonly attribute ShadowRoot? containingShadowRoot;
121 // Mozilla devtools-specific stuff
123 * If this element is a flex item (or has one or more anonymous box ancestors
124 * that chain up to an anonymous flex item), then this method returns the
125 * flex container that the flex item participates in. Otherwise, this method
129 readonly attribute Element? parentFlexElement;
132 [Func="mozilla::dom::AccessibleNode::IsAOMEnabled", SameObject]
133 readonly attribute AccessibleNode? accessibleNode;
137 dictionary GetRootNodeOptions {
138 boolean composed = false;