mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Ensure Element ID modifications inside disconnected shadow roots are registered (#34834)
* Add test for modifying element IDs in disconnected shadow roots Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Register element ID modifications inside disconnected shadow roots Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Don't crash when registering named elements in disconnected shadow roots Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Fix test title Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
parent
1ab55e6b11
commit
75a22cfe2e
4 changed files with 30 additions and 2 deletions
7
tests/wpt/meta/MANIFEST.json
vendored
7
tests/wpt/meta/MANIFEST.json
vendored
|
@ -766457,6 +766457,13 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"getElementById-dynamic-002.html": [
|
||||
"8fb1934c60753c39c081fa97987bbdf1cc68a521",
|
||||
[
|
||||
null,
|
||||
{}
|
||||
]
|
||||
],
|
||||
"historical.html": [
|
||||
"4fa8be1dbc9537b904d51b74e8de37dc36a471d6",
|
||||
[
|
||||
|
|
20
tests/wpt/tests/shadow-dom/getElementById-dynamic-002.html
vendored
Normal file
20
tests/wpt/tests/shadow-dom/getElementById-dynamic-002.html
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
<!doctype html>
|
||||
<title>Shadow DOM: Modifying an element ID inside a disconnected shadow root does not break getElementById</title>
|
||||
<link rel="help" href="https://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid">
|
||||
<link rel="author" name="Simon Wülker">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="host"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
let host = document.getElementById("host");
|
||||
host.attachShadow({ mode: "open" }).innerHTML = `<div id="test-id"></div>`;
|
||||
let element = host.shadowRoot.getElementById("test-id");
|
||||
assert_true(!!element);
|
||||
|
||||
host.remove();
|
||||
host.shadowRoot.getElementById("test-id").id = "new-id";
|
||||
|
||||
assert_equals(host.shadowRoot.getElementById("new-id"), element);
|
||||
}, "ShadowRoot.getElementById works on elements whose id was modified after the root was disconnected");
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue