mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-12 01:10:42 +00:00
Base: Add a test for [SameObject] behavior in LibWeb
This commit is contained in:
parent
2157745093
commit
c884aa3f25
Notes:
sideshowbarker
2024-07-17 04:07:58 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/c884aa3f25 Pull-request: https://github.com/SerenityOS/serenity/pull/16175 Reviewed-by: https://github.com/ADKaster
1 changed files with 52 additions and 0 deletions
|
@ -0,0 +1,52 @@
|
|||
<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>
|
Loading…
Reference in a new issue