Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /dom/nodes/ParentNode-querySelector-scope-numeric-id.xhtml - WPT Dashboard Interop Dashboard
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<head>
<title>querySelector with :scope on element with numeric ID</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="9a">
<b id="target_b"/>
</div>
<script>
//<![CDATA[
"use strict";
test(() => {
const scopeElement = document.getElementById("9a");
assert_not_equals(scopeElement, null, "Element with numeric ID '9a' should exist");
const result = scopeElement.querySelector(":scope > b");
assert_not_equals(result, null, "querySelector should find the child 'b' element");
assert_equals(result.id, "target_b", "querySelector should return the correct 'b' element");
});
//]]>
</script>
</body>
</html>