ladybird/Base/res/html/tests/sameobject-behavior-for-htmlcollection-properties.html

53 lines
1.2 KiB
HTML

<html>
<style>
.ball {
border-radius: 9999px;
width: 40px;
height: 40px;
display: inline-block;
}
.pass {
background: green;
}
.fail {
background: red;
}
</style>
<p>This test verifies that various HTMLCollection properties have <b>[SameObject]</b> behavior.</p>
<p>You should see a bunch of green balls below this line.</p>
<div id="out"></div>
<form><table><thead><tr><td></td></tr></thead></table></form>
<script>
let out = document.querySelector("#out")
function test(expr) {
let a = eval(expr)
let b = eval(expr)
let e = document.createElement("div")
e.className = "ball " + ((a === b) ? "pass" : "fail")
out.appendChild(e)
}
let table = document.querySelector("table")
let tr = document.querySelector("tr")
let form = document.querySelector("form")
let thead = document.querySelector("thead")
test("table.tBodies")
test("table.rows")
test("thead.rows")
test("tr.cells")
test("form.elements")
test("document.applets")
test("document.anchors")
test("document.images")
test("document.embeds")
test("document.plugins")
test("document.links")
test("document.forms")
test("document.scripts")
</script>
</html>