diff options
Diffstat (limited to 'components/script/dom/webidls')
4 files changed, 82 insertions, 0 deletions
diff --git a/components/script/dom/webidls/XPathEvaluator.webidl b/components/script/dom/webidls/XPathEvaluator.webidl new file mode 100644 index 00000000000..8586b19232b --- /dev/null +++ b/components/script/dom/webidls/XPathEvaluator.webidl @@ -0,0 +1,30 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +// https://dom.spec.whatwg.org/#mixin-xpathevaluatorbase +interface mixin XPathEvaluatorBase { + [NewObject, Throws, Pref="dom.xpath.enabled"] XPathExpression createExpression( + DOMString expression, + optional XPathNSResolver? resolver = null + ); + Node createNSResolver(Node nodeResolver); // legacy + // XPathResult.ANY_TYPE = 0 + [Throws, Pref="dom.xpath.enabled"] XPathResult evaluate( + DOMString expression, + Node contextNode, + optional XPathNSResolver? resolver = null, + optional unsigned short type = 0, + optional XPathResult? result = null + ); +}; + +Document includes XPathEvaluatorBase; + +// https://dom.spec.whatwg.org/#interface-xpathevaluator +[Exposed=Window, Pref="dom.xpath.enabled"] +interface XPathEvaluator { + constructor(); +}; + +XPathEvaluator includes XPathEvaluatorBase; diff --git a/components/script/dom/webidls/XPathExpression.webidl b/components/script/dom/webidls/XPathExpression.webidl new file mode 100644 index 00000000000..bf5ba2b83aa --- /dev/null +++ b/components/script/dom/webidls/XPathExpression.webidl @@ -0,0 +1,14 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +// https://dom.spec.whatwg.org/#interface-xpathexpression +[Exposed=Window, Pref="dom.xpath.enabled"] +interface XPathExpression { + // XPathResult.ANY_TYPE = 0 + [Throws] XPathResult evaluate( + Node contextNode, + optional unsigned short type = 0, + optional XPathResult? result = null + ); +}; diff --git a/components/script/dom/webidls/XPathNSResolver.webidl b/components/script/dom/webidls/XPathNSResolver.webidl new file mode 100644 index 00000000000..099f6afd105 --- /dev/null +++ b/components/script/dom/webidls/XPathNSResolver.webidl @@ -0,0 +1,9 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +// https://dom.spec.whatwg.org/#mixin-xpathevaluatorbase +[Exposed=Window] +callback interface XPathNSResolver { + DOMString? lookupNamespaceURI(DOMString? prefix); +}; diff --git a/components/script/dom/webidls/XPathResult.webidl b/components/script/dom/webidls/XPathResult.webidl new file mode 100644 index 00000000000..25e87e3024a --- /dev/null +++ b/components/script/dom/webidls/XPathResult.webidl @@ -0,0 +1,29 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +// https://dom.spec.whatwg.org/#interface-xpathresult +[Exposed=Window, Pref="dom.xpath.enabled"] +interface XPathResult { + const unsigned short ANY_TYPE = 0; + const unsigned short NUMBER_TYPE = 1; + const unsigned short STRING_TYPE = 2; + const unsigned short BOOLEAN_TYPE = 3; + const unsigned short UNORDERED_NODE_ITERATOR_TYPE = 4; + const unsigned short ORDERED_NODE_ITERATOR_TYPE = 5; + const unsigned short UNORDERED_NODE_SNAPSHOT_TYPE = 6; + const unsigned short ORDERED_NODE_SNAPSHOT_TYPE = 7; + const unsigned short ANY_UNORDERED_NODE_TYPE = 8; + const unsigned short FIRST_ORDERED_NODE_TYPE = 9; + + readonly attribute unsigned short resultType; + [Throws] readonly attribute unrestricted double numberValue; + [Throws] readonly attribute DOMString stringValue; + [Throws] readonly attribute boolean booleanValue; + [Throws] readonly attribute Node? singleNodeValue; + [Throws] readonly attribute boolean invalidIteratorState; + [Throws] readonly attribute unsigned long snapshotLength; + + [Throws] Node? iterateNext(); + [Throws] Node? snapshotItem(unsigned long index); +}; |