Skip to content

Commit 6f19749

Browse files
soosungp33chromium-wpt-export-bot
authored andcommitted
Make singleNodeValue nullable to match DOM spec
This patch updates the singleNodeValue attribute from non-nullable to nullable to match the DOM specification. Since null was already returned regardless of the IDL change, this patch is not an actual behavior change. Bug: 456874035 Change-Id: Ib6b69c8c991a6a21d531242c87bcdf4e51bc40ef Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7109180 Reviewed-by: Joey Arhar <[email protected]> Commit-Queue: YeongHan Kim <[email protected]> Reviewed-by: Jinho Bang <[email protected]> Cr-Commit-Position: refs/heads/main@{#1542186}
1 parent 68facf0 commit 6f19749

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!DOCTYPE html>
2+
<meta charset="UTF-8">
3+
<title>XPathResult singleNodeValue should be nullable</title>
4+
<link rel=help href="https://dom.spec.whatwg.org/#dom-xpathresult-singlenodevalue">
5+
<script src="/resources/testharness.js"></script>
6+
<script src="/resources/testharnessreport.js"></script>
7+
<body>
8+
<div id="div">
9+
<span id="exist"></span>
10+
</div>
11+
<script>
12+
test(() => {
13+
const div = document.getElementById('div');
14+
15+
const isNull = document.evaluate(
16+
'//non-span',
17+
div,
18+
null,
19+
XPathResult.FIRST_ORDERED_NODE_TYPE,
20+
null
21+
);
22+
assert_equals(isNull.singleNodeValue, null);
23+
24+
const isNotNull = document.evaluate(
25+
'//span',
26+
div,
27+
null,
28+
XPathResult.FIRST_ORDERED_NODE_TYPE,
29+
null
30+
);
31+
assert_not_equals(isNotNull.singleNodeValue, null);
32+
}, 'singleNodeValue should be nullable');
33+
</script>
34+
</body>

0 commit comments

Comments
 (0)