mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-03 04:52:06 +02:00
LibWeb: Use correct factory function when cloning a Document node
Cloning an XMLDocument should produce a new XMLDocument. Same for HTMLDocument. This fixes at least one WPT test, which we're also importing. :^)
This commit is contained in:
committed by
Tim Ledbetter
parent
24a6fd3d76
commit
564dc0a434
Notes:
github-actions[bot]
2024-11-19 19:25:40 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/564dc0a434b Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2441 Reviewed-by: https://github.com/tcl3 ✅
@@ -0,0 +1,28 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Cloning of an XMLDocument</title>
|
||||
<link rel="help" href="https://dom.spec.whatwg.org/#dom-node-clonenode">
|
||||
<link rel="help" href="https://dom.spec.whatwg.org/#concept-node-clone">
|
||||
|
||||
<!-- This is testing in particular "that implements the same interfaces as node" -->
|
||||
|
||||
<script src="../../resources/testharness.js"></script>
|
||||
<script src="../../resources/testharnessreport.js"></script>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
test(() => {
|
||||
const doc = document.implementation.createDocument("namespace", "");
|
||||
|
||||
assert_equals(
|
||||
doc.constructor, XMLDocument,
|
||||
"Precondition check: document.implementation.createDocument() creates an XMLDocument"
|
||||
);
|
||||
|
||||
const clone = doc.cloneNode(true);
|
||||
|
||||
assert_equals(clone.constructor, XMLDocument);
|
||||
}, "Created with createDocument");
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user