8000 xpath: Let the parents of attribute nodes be their owner elements by simonwuelker · Pull Request #39749 · servo/servo · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add web platform test
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
  • Loading branch information
simonwuelker committed Oct 9, 2025
commit d4f2a054f92ba6a49170ffbc93c48b12a338eca1
7 changes: 7 additions & 0 deletions tests/wpt/meta/MANIFEST.json
< EAD9 td id="diff-2b3ee7923504068402be2563532cd736563561cf6d5e104db36d11d29d19bc9fL648690" data-line-number="648690" class="blob-num blob-num-context js-linkable-line-number">
Original file line number Diff line number Diff line change
Expand Up @@ -648688,6 +648688,13 @@
{}
]
],
"elements-are-parents-of-their-attributes.html": [
"63e6cfe4cc586c799a1b7f625407e64260e44b55",
[
null,
{}
]
],
"evaluator-constructor.html": [
"8350ceb4499d570c577f9aec674435b415b6672b",
[
Expand Down
Original file line number Diff line number Diff line change
@@ -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>
Loading
0