forked from LadybirdBrowser/ladybird
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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. :^)
- Loading branch information
1 parent
24a6fd3
commit 98b1df6
Showing
3 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
Tests/LibWeb/Text/expected/wpt-import/dom/nodes/Node-cloneNode-XMLDocument.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Summary | ||
|
||
Harness status: OK | ||
|
||
Rerun | ||
|
||
Found 1 tests | ||
|
||
1 Pass | ||
Details | ||
Result Test Name MessagePass Created with createDocument |
28 changes: 28 additions & 0 deletions
28
Tests/LibWeb/Text/input/wpt-import/dom/nodes/Node-cloneNode-XMLDocument.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |