servo/components/script/dom/webidls/XPathEvaluator.webidl
Ville Lindholm bc7fe41a02
Add XPath parser/evaluator (#34463)
* Add XPath parser/evaluator

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

* Correctly annotate XPathEvaluator IDL

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

* [PR review]: have bindings pass in `can_gc`

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

* [PR review]: add docstrings

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

* [PR review]: implement PartialEq for Value for readability

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

* [PR review]: add docstrings for CoreFunctions

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

* [PR review]: simplify node test code

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

* [PR review]: add unit tests for string handling xpath functions

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

* put xpath features behind dom.xpath.enabled pref

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

* [PR review] remove rstest and insta dev-deps

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

* update wpt test expectations

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

* [PR review]: tweak metadata files

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

* update wpt test expectations AGAIN

Signed-off-by: Ville Lindholm <ville@lindholm.dev>

---------

Signed-off-by: Ville Lindholm <ville@lindholm.dev>
2024-12-08 02:01:50 +00:00

30 lines
1,016 B
Text

/* 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;