dom: implement document.createDocumentFragment

This commit is contained in:
Pierre Tachoire
2023-12-01 14:43:06 +01:00
parent 555bce9f0b
commit 1bcedead56
7 changed files with 152 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>querySelectorAll should still work on DocumentFragments after they are modified</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!-- Regression test for https://github.com/jsdom/jsdom/issues/2290 -->
<script>
"use strict";
setup({ single_test: true });
const frag = document.createDocumentFragment();
frag.appendChild(document.createElement("div"));
assert_array_equals(frag.querySelectorAll("img"), [], "before modification");
frag.appendChild(document.createElement("div"));
// If the bug is present, this will throw.
assert_array_equals(frag.querySelectorAll("img"), [], "after modification");
done();
</script>