LibWeb: Allow moving StyleSheets between documents without falling apart

We have to unregister link element stylesheets from the old document's
StyleSheetList when moving them into a new document.

This makes it possible to load GitHub contributor graphs. :^)
This commit is contained in:
Andreas Kling
2024-04-21 19:46:37 +02:00
parent 511e411def
commit 8e56367092
Notes: sideshowbarker 2024-07-18 00:54:03 +09:00
4 changed files with 24 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
<script src="../include.js"></script>
<script>
let doc = new DOMParser().parseFromString(`<link rel="stylesheet" href="data:text/css,div{}">`, `text/html`);
let link = doc.head.firstChild;
document.head.appendChild(link);
test(() => {
println("Sheets in old doc: " + doc.styleSheets.length)
println("Sheets in new doc: " + document.styleSheets.length)
println("PASS (didn't crash)");
})
</script>