testing/web-platform/tests/html/dom/documents/dom-tree-accessors/document.links.html
author Oriol Brufau <oriol-bugzilla@hotmail.com>
Sat, 01 Oct 2022 13:46:04 +0000
changeset 636761 dfcb3426698bfa6bdf3d36ed5d81c59375519575
parent 415317 004007aee1cc4eb42dbed6cf0834170f4f523c82
permissions -rw-r--r--
Bug 1792886 - Enable contain-intrinsic-size by default. r=emilio Intent to ship: https://groups.google.com/a/mozilla.org/g/dev-platform/c/QtMpDO5ZHk8 Differential Revision: https://phabricator.services.mozilla.com/D158368

<!doctype html>
<meta charset=utf-8>
<title>Document.links</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>
<div id=test>
<a href=""></a>
<a href=""></a>
</div>
<script>
test(function() {
  var div = document.getElementById("test");
  var links = document.links;
  assert_true(links instanceof HTMLCollection);
  assert_equals(links.length, 2);

  var a = document.createElement("a");
  a.setAttribute("href", "");
  div.appendChild(a);
  assert_equals(links.length, 3);

  div.removeChild(a);
  assert_equals(links.length, 2);
}, "Document.links should be a live collection");
</script>