Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!doctype html>
<meta charset=utf-8>
<title>Objects whose prototype is an HTMLCollection</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
test(function() {
var obj = Object.create(document.getElementsByTagName("script"));
assert_throws_js(TypeError, function() {
}, "HTMLCollection as a prototype should not allow getting .length on the base object")
test(function() {
var element = document.createElement("p"); = "named";
this.add_cleanup(function() { element.remove() });
var collection = document.getElementsByTagName("p");
assert_equals(collection.named, element);
var object = Object.create(collection);
assert_equals(object.named, element);
object.named = "foo";
assert_equals(object.named, "foo");
assert_equals(collection.named, element);
}, "HTMLCollection as a prototype and setting own properties")