summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/dom/documents/dom-tree-accessors/document.links.html
blob: 69c7d8c52c619dbafec0b3379b251d5d03c4fbbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!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>