Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wpt: add document.getElementsByClassName tests
Browse files Browse the repository at this point in the history
krichprollsch committed Nov 19, 2023

Unverified

This user has not yet uploaded their public signing key.
1 parent eed9c9e commit c73e647
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/wpt/dom/Document-getElementsByClassName.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<title>Document.getElementsByClassName</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
test(function() {
var a = document.createElement("a"),
b = document.createElement("b");
a.className = "foo";
this.add_cleanup(function() {document.body.removeChild(a);});
document.body.appendChild(a);

var l = document.getElementsByClassName("foo");
assert_true(l instanceof HTMLCollection);
assert_equals(l.length, 1);

b.className = "foo";
document.body.appendChild(b);
assert_equals(l.length, 2);

document.body.removeChild(b);
assert_equals(l.length, 1);
}, "getElementsByClassName() should be a live collection");
</script>

0 comments on commit c73e647

Please sign in to comment.