Bug 1453234 [wpt PR 8993] - Add tests for liveness of NodeLists/HTMLCollections, a=testonly
authorkaixinjxq <xiuqix.jiang@intel.com>
Sun, 22 Apr 2018 08:39:21 +0000
changeset 415317 004007aee1cc4eb42dbed6cf0834170f4f523c82
parent 415316 3d4ea9d6a51a39ec972c3b4a14a91d32f8ba6911
child 415318 52d9682a524c29a7f724b20685c9aab1ede21c97
push id33894
push usercbrindusan@mozilla.com
push dateTue, 24 Apr 2018 21:51:36 +0000
treeherdermozilla-central@6eeb97ca94f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1453234
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1453234 [wpt PR 8993] - Add tests for liveness of NodeLists/HTMLCollections, a=testonly Automatic update from web-platform-testsAdd tests for liveness of NodeLists/HTMLCollections (#8993) * Add tests for liveness of NodeLists/HTMLCollections - Node#childNodes - ParentNode#children - {Document,Element}#getElementsByTagName - {Document,Element}#getElementsByTagNameNS - {Document,Element}#getElementsByClassName - Document#images - Document#embeds - Document#plugins - Document#links - Document#forms - Document#scripts - Document#getElementsByName * Move liveness tests to each of API test files * Fixed a nit issue * Modify the test description -- wpt-commits: 2d4fbd417e6772267c7755004e1022801fd3b92e wpt-pr: 8993
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/dom/nodes/Document-Element-getElementsByTagName.js
testing/web-platform/tests/dom/nodes/Document-Element-getElementsByTagNameNS.js
testing/web-platform/tests/dom/nodes/Document-getElementsByClassName.html
testing/web-platform/tests/dom/nodes/Element-getElementsByClassName.html
testing/web-platform/tests/dom/nodes/Node-childNodes.html
testing/web-platform/tests/dom/nodes/ParentNode-children.html
testing/web-platform/tests/html/dom/documents/dom-tree-accessors/document.embeds-document.plugins-01.html
testing/web-platform/tests/html/dom/documents/dom-tree-accessors/document.forms.html
testing/web-platform/tests/html/dom/documents/dom-tree-accessors/document.getElementsByName/document.getElementsByName-liveness.html
testing/web-platform/tests/html/dom/documents/dom-tree-accessors/document.images.html
testing/web-platform/tests/html/dom/documents/dom-tree-accessors/document.links.html
testing/web-platform/tests/html/dom/documents/dom-tree-accessors/document.scripts.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -323188,16 +323188,22 @@
     ]
    ],
    "dom/nodes/Document-getElementById.html": [
     [
      "/dom/nodes/Document-getElementById.html",
      {}
     ]
    ],
+   "dom/nodes/Document-getElementsByClassName.html": [
+    [
+     "/dom/nodes/Document-getElementsByClassName.html",
+     {}
+    ]
+   ],
    "dom/nodes/Document-getElementsByTagName-xhtml.xhtml": [
     [
      "/dom/nodes/Document-getElementsByTagName-xhtml.xhtml",
      {}
     ]
    ],
    "dom/nodes/Document-getElementsByTagName.html": [
     [
@@ -323740,16 +323746,22 @@
     ]
    ],
    "dom/nodes/ParentNode-append.html": [
     [
      "/dom/nodes/ParentNode-append.html",
      {}
     ]
    ],
+   "dom/nodes/ParentNode-children.html": [
+    [
+     "/dom/nodes/ParentNode-children.html",
+     {}
+    ]
+   ],
    "dom/nodes/ParentNode-prepend.html": [
     [
      "/dom/nodes/ParentNode-prepend.html",
      {}
     ]
    ],
    "dom/nodes/ParentNode-querySelector-All-xht.xht": [
     [
@@ -330350,16 +330362,22 @@
     ]
    ],
    "html/dom/documents/dom-tree-accessors/document.getElementsByName/document.getElementsByName-interface.html": [
     [
      "/html/dom/documents/dom-tree-accessors/document.getElementsByName/document.getElementsByName-interface.html",
      {}
     ]
    ],
+   "html/dom/documents/dom-tree-accessors/document.getElementsByName/document.getElementsByName-liveness.html": [
+    [
+     "/html/dom/documents/dom-tree-accessors/document.getElementsByName/document.getElementsByName-liveness.html",
+     {}
+    ]
+   ],
    "html/dom/documents/dom-tree-accessors/document.getElementsByName/document.getElementsByName-namespace-xhtml.xhtml": [
     [
      "/html/dom/documents/dom-tree-accessors/document.getElementsByName/document.getElementsByName-namespace-xhtml.xhtml",
      {}
     ]
    ],
    "html/dom/documents/dom-tree-accessors/document.getElementsByName/document.getElementsByName-namespace.html": [
     [
@@ -330422,16 +330440,28 @@
     ]
    ],
    "html/dom/documents/dom-tree-accessors/document.images.html": [
     [
      "/html/dom/documents/dom-tree-accessors/document.images.html",
      {}
     ]
    ],
+   "html/dom/documents/dom-tree-accessors/document.links.html": [
+    [
+     "/html/dom/documents/dom-tree-accessors/document.links.html",
+     {}
+    ]
+   ],
+   "html/dom/documents/dom-tree-accessors/document.scripts.html": [
+    [
+     "/html/dom/documents/dom-tree-accessors/document.scripts.html",
+     {}
+    ]
+   ],
    "html/dom/documents/dom-tree-accessors/document.title-01.html": [
     [
      "/html/dom/documents/dom-tree-accessors/document.title-01.html",
      {}
     ]
    ],
    "html/dom/documents/dom-tree-accessors/document.title-02.xhtml": [
     [
@@ -549750,21 +549780,21 @@
    "e2487daf724039c3a5c740ff0b51392d7a56058f",
    "support"
   ],
   "dom/nodes/DOMImplementation-hasFeature.html": [
    "05920c30e9cfd602adb3bb28039385e952bacdd2",
    "testharness"
   ],
   "dom/nodes/Document-Element-getElementsByTagName.js": [
-   "df4c41917cd6bd047a11cea390fa075e6a01fe03",
+   "cd457938b1a4ef6c82dc992f739d5e142e90582c",
    "support"
   ],
   "dom/nodes/Document-Element-getElementsByTagNameNS.js": [
-   "e34e5db66000a8aa51caa26b0725bd171ee4ceb5",
+   "4442c3a7aba3d1a9ead2a08d312dd221c0bade90",
    "support"
   ],
   "dom/nodes/Document-URL.sub.html": [
    "1b04398f6f5657ca4ed97d41de565fe52e1853e2",
    "testharness"
   ],
   "dom/nodes/Document-adoptNode.html": [
    "30b4aa92d7d7811f4c6b71cc543cd09ecb3a19f1",
@@ -550109,16 +550139,20 @@
   "dom/nodes/Document-doctype.html": [
    "5b455e9de30ef254952c18d60b4de8051b846449",
    "testharness"
   ],
   "dom/nodes/Document-getElementById.html": [
    "622f70a9123e23fb28339b98b24d95fa54def236",
    "testharness"
   ],
+  "dom/nodes/Document-getElementsByClassName.html": [
+   "9379a41650aef0a9a83dd1551b78326537c35b15",
+   "testharness"
+  ],
   "dom/nodes/Document-getElementsByTagName-xhtml.xhtml": [
    "c2ed3b4aa2f3dbdf979f31232120c929b472a7d8",
    "testharness"
   ],
   "dom/nodes/Document-getElementsByTagName.html": [
    "bff4946bcc185442f86f58e23550dc8a215aa7aa",
    "testharness"
   ],
@@ -550246,17 +550280,17 @@
    "680e43edc4a8b5e598a21957d9b5d6da4b4b87ae",
    "testharness"
   ],
   "dom/nodes/Element-firstElementChild.html": [
    "2efe10d7972a766ca5c0d4409f323e0bc782fca1",
    "testharness"
   ],
   "dom/nodes/Element-getElementsByClassName.html": [
-   "ca63b57d7c11907c316f4c6bf95ea0b007370cfb",
+   "9054ea6a532ce3478667ddca98f6d067705ff774",
    "testharness"
   ],
   "dom/nodes/Element-getElementsByTagName-change-document-HTMLNess-iframe.xml": [
    "a05d91cbf0902b0fe341c979e9fc18fc69813f55",
    "support"
   ],
   "dom/nodes/Element-getElementsByTagName-change-document-HTMLNess.html": [
    "ea00b5982fc34a20bc6b875f69d0a873816c07c1",
@@ -550390,17 +550424,17 @@
    "7478f80b185f916f5b89264f845d4d10e3ae4ccb",
    "testharness"
   ],
   "dom/nodes/Node-baseURI.html": [
    "141693242b110f7e0792efdd82f4c16e37653294",
    "testharness"
   ],
   "dom/nodes/Node-childNodes.html": [
-   "29ae8fe6e50a9080aea5710ff96b253d6b4a77e0",
+   "56c9c134e67d130575cd0c76a0e801918360bc6b",
    "testharness"
   ],
   "dom/nodes/Node-cloneNode.html": [
    "d4ab5a700e36fa6b8c26ffc6703d2a9020b5336e",
    "testharness"
   ],
   "dom/nodes/Node-compareDocumentPosition.html": [
    "f0fff76218759f57e76cabafba32c2a1e6538532",
@@ -550501,16 +550535,20 @@
   "dom/nodes/NodeList-Iterable.html": [
    "5f5ff52322f53a282b7b1cf37f452f58c274de92",
    "testharness"
   ],
   "dom/nodes/ParentNode-append.html": [
    "b296c6d2500ff9c3a7d3ec6deefbbafd428cd2f2",
    "testharness"
   ],
+  "dom/nodes/ParentNode-children.html": [
+   "d5fd7b0858ac6df0c7d3aedf78af16fc0e0dbdd5",
+   "testharness"
+  ],
   "dom/nodes/ParentNode-prepend.html": [
    "2b746fc8edbbce6c2ac50d5d8c4200bfd29035e9",
    "testharness"
   ],
   "dom/nodes/ParentNode-querySelector-All-content.html": [
    "6f8c08e2c6dd453f07040f6e0dfaac2496d83bfa",
    "support"
   ],
@@ -559422,21 +559460,21 @@
    "c841aa05ad82b8524e8daebfa1895265877fc124",
    "testharness"
   ],
   "html/dom/documents/dom-tree-accessors/cross-domain.js": [
    "1b90eb1cfe9323abbf7c91f3576daf48e311a3c7",
    "support"
   ],
   "html/dom/documents/dom-tree-accessors/document.embeds-document.plugins-01.html": [
-   "ef1b94e91aa27775e28a7ed47af5e2da5121a1d9",
+   "d5eb89e2511e7660650823d3f1aa54897dbc09ea",
    "testharness"
   ],
   "html/dom/documents/dom-tree-accessors/document.forms.html": [
-   "49f2c03f580ce51aa409699877d712163b91a086",
+   "c639061fe9234c8ca3180c2d5a63d4aa144925d8",
    "testharness"
   ],
   "html/dom/documents/dom-tree-accessors/document.getElementsByClassName-same.html": [
    "632695eaf87182699eb0f3a12a8bb206824ca6ed",
    "testharness"
   ],
   "html/dom/documents/dom-tree-accessors/document.getElementsByName/document.getElementsByName-case-xhtml.xhtml": [
    "29ab9f8e650ce434189cbffefde159c088ef26b0",
@@ -559453,16 +559491,20 @@
   "html/dom/documents/dom-tree-accessors/document.getElementsByName/document.getElementsByName-id.html": [
    "b0fbcdfd450e6ec037d0318102ec6efb381e5cd2",
    "testharness"
   ],
   "html/dom/documents/dom-tree-accessors/document.getElementsByName/document.getElementsByName-interface.html": [
    "413e146cd4f509834736b60ad14613ff770714d1",
    "testharness"
   ],
+  "html/dom/documents/dom-tree-accessors/document.getElementsByName/document.getElementsByName-liveness.html": [
+   "8df11ad97aa6b127afe9bc5272b090fb022c2f8e",
+   "testharness"
+  ],
   "html/dom/documents/dom-tree-accessors/document.getElementsByName/document.getElementsByName-namespace-xhtml.xhtml": [
    "f3c4f1f114a40f9705b6a38948a10717a2867ba4",
    "testharness"
   ],
   "html/dom/documents/dom-tree-accessors/document.getElementsByName/document.getElementsByName-namespace.html": [
    "f518f22c7a01a4e715410ca34c8e3d5b2850b469",
    "testharness"
   ],
@@ -559498,17 +559540,25 @@
    "0d7d9f2712f76c9a702e0e69ea332029780cce51",
    "testharness"
   ],
   "html/dom/documents/dom-tree-accessors/document.head-02.html": [
    "9b9510eecd53f2ea88a723a86c0529c57532c762",
    "testharness"
   ],
   "html/dom/documents/dom-tree-accessors/document.images.html": [
-   "a56a1a40de89b2da44f52136dc6157809a165674",
+   "83007edc65b4eeeb362c7989c90f58f045392efc",
+   "testharness"
+  ],
+  "html/dom/documents/dom-tree-accessors/document.links.html": [
+   "9f1e7703207c5505b269e1a74332697f707aeda5",
+   "testharness"
+  ],
+  "html/dom/documents/dom-tree-accessors/document.scripts.html": [
+   "bd87c79ce737c13c0480947f69b1741e88042330",
    "testharness"
   ],
   "html/dom/documents/dom-tree-accessors/document.title-01.html": [
    "d3c03d55b4dbc9ae98a73a4ad4bcc7ac7f6e8ecf",
    "testharness"
   ],
   "html/dom/documents/dom-tree-accessors/document.title-02.xhtml": [
    "cdc0146d8432f592eeb68614f69c4b9437fb712b",
--- a/testing/web-platform/tests/dom/nodes/Document-Element-getElementsByTagName.js
+++ b/testing/web-platform/tests/dom/nodes/Document-Element-getElementsByTagName.js
@@ -185,9 +185,24 @@ function test_getElementsByTagName(conte
           expected.push(child);
           get_elements(child);
         }
       }
     }
     get_elements(context);
     assert_array_equals(actual, expected);
   }, "getElementsByTagName('*')")
+
+  test(function() {
+    var t1 = element.appendChild(document.createElement("abc"));
+    this.add_cleanup(function() {element.removeChild(t1)});
+
+    var l = context.getElementsByTagName("abc");
+    assert_true(l instanceof HTMLCollection);
+    assert_equals(l.length, 1);
+
+    var t2 = element.appendChild(document.createElement("abc"));
+    assert_equals(l.length, 2);
+
+    element.removeChild(t2);
+    assert_equals(l.length, 1);
+  }, "getElementsByTagName() should be a live collection");
 }
--- a/testing/web-platform/tests/dom/nodes/Document-Element-getElementsByTagNameNS.js
+++ b/testing/web-platform/tests/dom/nodes/Document-Element-getElementsByTagNameNS.js
@@ -120,9 +120,24 @@ function test_getElementsByTagNameNS(con
     assert_array_equals(actual, expected);
   }, "getElementsByTagNameNS('*', '*')")
 
   test(function() {
     assert_array_equals(context.getElementsByTagNameNS("**", "*"), []);
     assert_array_equals(context.getElementsByTagNameNS(null, "0"), []);
     assert_array_equals(context.getElementsByTagNameNS(null, "div"), []);
   }, "Empty lists")
+
+  test(function() {
+    var t1 = element.appendChild(document.createElementNS("test", "abc"));
+    this.add_cleanup(function() {element.removeChild(t1)});
+
+    var l = context.getElementsByTagNameNS("test", "abc");
+    assert_true(l instanceof HTMLCollection);
+    assert_equals(l.length, 1);
+
+    var t2 = element.appendChild(document.createElementNS("test", "abc"));
+    assert_equals(l.length, 2);
+
+    element.removeChild(t2);
+    assert_equals(l.length, 1);
+  }, "getElementsByTagNameNS() should be a live collection");
 }
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/dom/nodes/Document-getElementsByClassName.html
@@ -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>
--- a/testing/web-platform/tests/dom/nodes/Element-getElementsByClassName.html
+++ b/testing/web-platform/tests/dom/nodes/Element-getElementsByClassName.html
@@ -8,14 +8,36 @@ test(function() {
   var a = document.createElement("a"), b = document.createElement("b")
   b.className = "foo"
   a.appendChild(b)
   var list = a.getElementsByClassName("foo")
   assert_array_equals(list, [b])
   var secondList = a.getElementsByClassName("foo")
   assert_true(list === secondList || list !== secondList, "Caching is allowed.")
 }, "getElementsByClassName should work on disconnected subtrees.")
+
 test(function() {
   var list = document.getElementsByClassName("foo")
   assert_false(list instanceof NodeList, "NodeList")
   assert_true(list instanceof HTMLCollection, "HTMLCollection")
 }, "Interface should be correct.")
+
+test(function() {
+  var a = document.createElement("a");
+  var b = document.createElement("b");
+  var c = document.createElement("c");
+  b.className = "foo";
+  document.body.appendChild(a);
+  this.add_cleanup(function() {document.body.removeChild(a)});
+  a.appendChild(b);
+
+  var l = a.getElementsByClassName("foo");
+  assert_true(l instanceof HTMLCollection);
+  assert_equals(l.length, 1);
+
+  c.className = "foo";
+  a.appendChild(c);
+  assert_equals(l.length, 2);
+
+  a.removeChild(c);
+  assert_equals(l.length, 1);
+}, "getElementsByClassName() should be a live collection");
 </script>
--- a/testing/web-platform/tests/dom/nodes/Node-childNodes.html
+++ b/testing/web-platform/tests/dom/nodes/Node-childNodes.html
@@ -2,16 +2,19 @@
 <meta charset=utf-8>
 <title>Node.childNodes</title>
 <link rel=help href="https://dom.spec.whatwg.org/#dom-node-childnodes">
 <link rel=author title="Tim Taubert" href="mailto:ttaubert@mozilla.com">
 <link rel=author title="Ms2ger" href="mailto:Ms2ger@gmail.com">
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <div id="log"></div>
+<div style="display: none">
+  <ul id='test'><li>1</li><li>2</li><li>3</li><li>4</li></ul>
+</div>
 <script>
 test(function() {
   var element = document.createElement("p");
   assert_equals(element.childNodes, element.childNodes);
 }, "Caching of Node.childNodes");
 
 var check_parent_node = function(node) {
   assert_array_equals(node.childNodes, []);
@@ -91,9 +94,24 @@ test(function() {
   assert_equals(list[Symbol.iterator], Array.prototype[Symbol.iterator]);
   assert_equals(list.keys, Array.prototype.keys);
   if (Array.prototype.values) {
     assert_equals(list.values, Array.prototype.values);
   }
   assert_equals(list.entries, Array.prototype.entries);
   assert_equals(list.forEach, Array.prototype.forEach);
 }, "Iterator behavior of Node.childNodes");
+
+
+test(() => {
+  var node = document.getElementById("test");
+  var children = node.childNodes;
+  assert_true(children instanceof NodeList);
+  var li = document.createElement("li");
+  assert_equals(children.length, 4);
+
+  node.appendChild(li);
+  assert_equals(children.length, 5);
+
+  node.removeChild(li);
+  assert_equals(children.length, 4);
+}, "Node.childNodes should be a live collection");
 </script>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/dom/nodes/ParentNode-children.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>ParentNode.children</title>
+<link rel=help href="https://dom.spec.whatwg.org/#dom-parentnode-children">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<div style="display: none">
+  <ul><li id='test'>1</li><li>2</li><li>3</li><li>4</li></ul>
+</div>
+<script>
+test(() => {
+  var node = document.getElementById("test");
+  var parentNode = node.parentNode;
+  var children = parentNode.children;
+  assert_true(children instanceof HTMLCollection);
+  var li = document.createElement("li");
+  assert_equals(children.length, 4);
+
+  parentNode.appendChild(li);
+  assert_equals(children.length, 5);
+
+  parentNode.removeChild(li);
+  assert_equals(children.length, 4);
+}, "ParentNode.children should be a live collection");
+</script>
+</html>
--- a/testing/web-platform/tests/html/dom/documents/dom-tree-accessors/document.embeds-document.plugins-01.html
+++ b/testing/web-platform/tests/html/dom/documents/dom-tree-accessors/document.embeds-document.plugins-01.html
@@ -47,9 +47,41 @@ test(function() {
 
   assert_equals(document.embeds, document.embeds,
                 "embeds should be constant");
   assert_equals(document.plugins, document.plugins,
                 "plugins should be constant");
   assert_equals(document.embeds, document.plugins,
                 "embeds should be the same as plugins");
 }, "Two plugins");
+
+test(function() {
+  var embed1 = document.createElement("embed"),
+      embed2 = document.createElement("embed");
+  document.body.appendChild(embed1);
+  this.add_cleanup(function() { document.body.removeChild(embed1) });
+  var embeds = document.embeds;
+  assert_true(embeds instanceof HTMLCollection);
+  assert_equals(embeds.length, 1);
+
+  document.body.appendChild(embed2);
+  assert_equals(embeds.length, 2);
+
+  document.body.removeChild(embed2);
+  assert_equals(embeds.length, 1);
+}, "Document.embeds should be a live collection");
+
+test(function() {
+  var embed1 = document.createElement("embed"),
+      embed2 = document.createElement("embed");
+  document.body.appendChild(embed1);
+  this.add_cleanup(function() { document.body.removeChild(embed1) });
+  var pls = document.plugins;
+  assert_true(pls instanceof HTMLCollection);
+  assert_equals(pls.length, 1);
+
+  document.body.appendChild(embed2);
+  assert_equals(pls.length, 2);
+
+  document.body.removeChild(embed2);
+  assert_equals(pls.length, 1);
+}, "Document.plugins should be a live collection");
 </script>
--- a/testing/web-platform/tests/html/dom/documents/dom-tree-accessors/document.forms.html
+++ b/testing/web-platform/tests/html/dom/documents/dom-tree-accessors/document.forms.html
@@ -62,9 +62,22 @@ test(function() {
   // prototype chain are then enumerated, in no defined order.
   assert_array_equals(result.sort(), ["item", "namedItem", "length"].sort())
 }, "document.forms iteration")
 
 test(function() {
   var result = Object.getOwnPropertyNames(document.forms);
   assert_array_equals(result, ["0", "1", "2", "form1", "form2"])
 }, "document.forms getOwnPropertyNames")
+
+test(function() {
+  var forms = document.forms;
+  assert_true(forms instanceof HTMLCollection);
+  assert_equals(forms.length, 3);
+
+  var form = document.createElement("form");
+  document.body.appendChild(form);
+  assert_equals(forms.length, 4);
+
+  document.body.removeChild(form);
+  assert_equals(forms.length, 3);
+}, "Document.forms should be a live collection");
 </script>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/dom/documents/dom-tree-accessors/document.getElementsByName/document.getElementsByName-liveness.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<title>Document.getElementsByName: liveness</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 input = document.createElement("input"),
+      embed = document.createElement("embed");
+  input.setAttribute("name", "test");
+  input.setAttribute("type", "text");
+  embed.setAttribute("name", "test");
+  document.body.appendChild(input);
+  this.add_cleanup(function() { document.body.removeChild(input) });
+  var e = document.getElementsByName("test");
+  assert_true(e instanceof NodeList);
+  assert_equals(e.length, 1);
+
+  document.body.appendChild(embed);
+  assert_equals(e.length, 2);
+
+  document.body.removeChild(embed);
+  assert_equals(e.length, 1);
+}, "Document.getElementsByName() should be a live collection");
+</script>
--- a/testing/web-platform/tests/html/dom/documents/dom-tree-accessors/document.images.html
+++ b/testing/web-platform/tests/html/dom/documents/dom-tree-accessors/document.images.html
@@ -97,9 +97,23 @@ test(function() {
   }, c);
 }, "Input elements should not be in the collection");
 
 test(function() {
   assert_equals(c[""], undefined);
   assert_equals(c.namedItem(""), null);
   assert_false("" in c, '"" in c');
 }, "The empty string should not be in the collections");
+
+test(function() {
+  var div = document.getElementById("test");
+  var imgs = document.images;
+  assert_true(imgs instanceof HTMLCollection);
+  assert_equals(imgs.length, 10);
+
+  var img = document.createElement("img");
+  div.appendChild(img);
+  assert_equals(imgs.length, 11);
+
+  div.removeChild(img);
+  assert_equals(imgs.length, 10);
+}, "Document.images should be a live collection");
 </script>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/dom/documents/dom-tree-accessors/document.links.html
@@ -0,0 +1,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>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/dom/documents/dom-tree-accessors/document.scripts.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Document.scripts</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 scripts = document.scripts;
+  assert_true(scripts instanceof HTMLCollection);
+  assert_equals(scripts.length, 3);
+
+  var script = document.createElement("script");
+  document.body.appendChild(script);
+  assert_equals(scripts.length, 4);
+
+  document.body.removeChild(script);
+  assert_equals(scripts.length, 3);
+}, "Document.scripts should be a live collection");
+</script>