Node.webidl (4824B)
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/. 5 * 6 * The origin of this IDL file is 7 * http://www.w3.org/TR/2012/WD-dom-20120105/ 8 * 9 * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C 10 * liability, trademark and document use rules apply. 11 */ 12 13 interface Principal; 14 interface URI; 15 16 [Exposed=Window] 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 30 [Constant] 31 readonly attribute unsigned short nodeType; 32 [Pure] 33 readonly attribute DOMString nodeName; 34 35 [Pure, Throws, NeedsCallerType, BinaryName="baseURIFromJS"] 36 readonly attribute DOMString? baseURI; 37 38 [Pure, BinaryName=isInComposedDoc] 39 readonly attribute boolean isConnected; 40 [Pure] 41 readonly attribute Document? ownerDocument; 42 [Pure] 43 Node getRootNode(optional GetRootNodeOptions options = {}); 44 [Pure] 45 readonly attribute Node? parentNode; 46 [Pure] 47 readonly attribute Element? parentElement; 48 [Pure] 49 boolean hasChildNodes(); 50 [SameObject] 51 readonly attribute NodeList childNodes; 52 [Pure] 53 readonly attribute Node? firstChild; 54 [Pure] 55 readonly attribute Node? lastChild; 56 [Pure] 57 readonly attribute Node? previousSibling; 58 [Pure] 59 readonly attribute Node? nextSibling; 60 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); 75 [CEReactions, Throws] 76 Node removeChild(Node child); 77 [CEReactions] 78 undefined normalize(); 79 80 [CEReactions, Throws, Func="IsNotUAWidget"] 81 Node cloneNode(optional boolean deep = false); 82 [Pure] 83 boolean isSameNode(Node? node); 84 [Pure] 85 boolean isEqualNode(Node? node); 86 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 93 [Pure] 94 unsigned short compareDocumentPosition(Node other); 95 [Pure] 96 boolean contains(Node? other); 97 98 [Pure] 99 DOMString? lookupPrefix(DOMString? namespace); 100 [Pure] 101 DOMString? lookupNamespaceURI(DOMString? prefix); 102 [Pure] 103 boolean isDefaultNamespace(DOMString? namespace); 104 105 // Mozilla-specific stuff 106 [ChromeOnly] 107 readonly attribute Principal nodePrincipal; 108 [ChromeOnly] 109 readonly attribute URI? baseURIObject; 110 [ChromeOnly] 111 DOMString generateXPath(); 112 [ChromeOnly, Pure, BinaryName="flattenedTreeParentNodeNonInline"] 113 readonly attribute Node? flattenedTreeParentNode; 114 [ChromeOnly, Pure, BinaryName="isInNativeAnonymousSubtree"] 115 readonly attribute boolean isNativeAnonymous; 116 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; 120 121 // Mozilla devtools-specific stuff 122 /** 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 126 * returns null. 127 */ 128 [ChromeOnly] 129 readonly attribute Element? parentFlexElement; 130 131 #ifdef ACCESSIBILITY 132 [Func="mozilla::dom::AccessibleNode::IsAOMEnabled", SameObject] 133 readonly attribute AccessibleNode? accessibleNode; 134 #endif 135 }; 136 137 dictionary GetRootNodeOptions { 138 boolean composed = false; 139 };