commit 7ffd35a1ea10ea1631090b6cdd9bb4fb56cd84a7
parent 30dbc11c0eeebc3517cba86263a5274c06078096
Author: Simon Wülker <simon.wuelker@arcor.de>
Date: Wed, 15 Oct 2025 08:24:47 +0000
Bug 1993640 [wpt PR 55339] - xpath: Let the parents of attribute nodes be their owner elements, a=testonly
Automatic update from web-platform-tests
Add web platform test
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
--
wpt-commits: 78e42d4f46cd1699d8de7c7f6695a122080ace6c
wpt-pr: 55339
Diffstat:
1 file changed, 41 insertions(+), 0 deletions(-)
diff --git a/testing/web-platform/tests/domxpath/elements-are-parents-of-their-attributes.html b/testing/web-platform/tests/domxpath/elements-are-parents-of-their-attributes.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Relationship between elements and their attributes</title>
+ <link rel="author" title="Simon Wülker" href="mailto:simon.wuelker@arcor.de">
+ <link rel="help" href="https://www.w3.org/TR/1999/REC-xpath-19991116/#attribute-nodes">
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="context" foo="bar"></div>
+ <script>
+ const context = document.getElementById("context");
+
+ test(() => {
+ const result = document.evaluate(
+ "@foo/parent::*",
+ context,
+ null,
+ XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+ null
+ );
+
+ assert_equals(result.iterateNext(), context);
+ assert_equals(result.iterateNext(), null);
+ }, "Elements are parents of their attributes");
+
+ test(() => {
+ const result = document.evaluate(
+ "node()",
+ context,
+ null,
+ XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+ null
+ );
+
+ assert_equals(result.iterateNext(), null);
+ }, "Attributes are not children of their parents");
+ </script>
+ </body>
+</html>