mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
Base: Add two HTML test pages for DOM cloneNode() functionality
This commit is contained in:
parent
b005e816a3
commit
7a51e846b2
Notes:
sideshowbarker
2024-07-17 03:14:48 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/7a51e846b2 Pull-request: https://github.com/SerenityOS/serenity/pull/16469 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/Dexesttp Reviewed-by: https://github.com/emilio
2 changed files with 69 additions and 0 deletions
38
Base/res/html/tests/Attr-cloneNode.html
Normal file
38
Base/res/html/tests/Attr-cloneNode.html
Normal file
|
@ -0,0 +1,38 @@
|
|||
<html>
|
||||
<body>
|
||||
<pre id="out"></pre>
|
||||
<script>
|
||||
function log(s) {
|
||||
document.getElementById("out").innerHTML += s + "\n"
|
||||
}
|
||||
|
||||
window.onload = function() {
|
||||
let e = document.createElement("div")
|
||||
e.setAttribute("foo", "bar")
|
||||
let attr = e.getAttributeNode("foo")
|
||||
let clone = attr.cloneNode()
|
||||
|
||||
function dumpAttr(name, attr) {
|
||||
log(name + ": " + attr)
|
||||
log(name + ".ownerElement: " + attr.ownerElement)
|
||||
log(name + ".namespaceURI: " + attr.namespaceURI)
|
||||
log(name + ".localName: " + attr.localName)
|
||||
log(name + ".name: " + attr.name)
|
||||
log(name + ".value: " + attr.value)
|
||||
log(name + ".specified: " + attr.specified)
|
||||
log("")
|
||||
}
|
||||
|
||||
dumpAttr("attr", attr)
|
||||
dumpAttr("clone", clone)
|
||||
|
||||
log("attr === clone -> " + (attr === clone))
|
||||
log("attr.isEqualNode(clone) -> " + attr.isEqualNode(clone))
|
||||
|
||||
e.setAttribute("baz", "bux")
|
||||
let other = e.getAttributeNode("baz")
|
||||
log("attr.isEqualNode(other) -> " + attr.isEqualNode(other))
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
31
Base/res/html/tests/ProcessingInstruction-cloneNode.html
Normal file
31
Base/res/html/tests/ProcessingInstruction-cloneNode.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
<html>
|
||||
<body>
|
||||
<pre id="out"></pre>
|
||||
<script>
|
||||
function log(s) {
|
||||
document.getElementById("out").innerHTML += s + "\n"
|
||||
}
|
||||
|
||||
window.onload = function() {
|
||||
let pi = document.createProcessingInstruction("someTarget", "someData")
|
||||
let clone = pi.cloneNode()
|
||||
|
||||
function dumpProcessingInstruction(name, pi) {
|
||||
log(name + ": " + pi)
|
||||
log(name + ".target: " + pi.target)
|
||||
log(name + ".data: " + pi.data)
|
||||
log("")
|
||||
}
|
||||
|
||||
dumpProcessingInstruction("pi", pi)
|
||||
dumpProcessingInstruction("clone", clone)
|
||||
|
||||
log("pi === clone -> " + (pi === clone))
|
||||
log("pi.isEqualNode(clone) -> " + pi.isEqualNode(clone))
|
||||
|
||||
let other = document.createProcessingInstruction("baz", "bux")
|
||||
log("pi.isEqualNode(other) -> " + pi.isEqualNode(other))
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue