chromium/third_party/blink/web_tests/external/wpt/dom/collections/HTMLCollection-as-prototype.html

<!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>
<script>
test(function() {
  var obj = Object.create(document.getElementsByTagName("script"));
  assert_throws_js(TypeError, function() {
    obj.length;
  });
}, "HTMLCollection as a prototype should not allow getting .length on the base object")

test(function() {
  var element = document.createElement("p");
  element.id = "named";
  document.body.appendChild(element);
  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")
</script>