Bug 1523562 [wpt PR 14819] - Add a test for deleting HTMLCollection properties., a=testonly
authorMs2ger <Ms2ger@gmail.com>
Thu, 31 Jan 2019 18:31:27 +0000
changeset 457964 a0c427e5a73503988936d6d8e03413d82b57af32
parent 457963 90a9ca261515abd3302c6ef67e18617c933be388
child 457965 0673e1c73a179d91712583880d4a6f3eb525a4a1
push id35518
push useropoprus@mozilla.com
push dateFri, 08 Feb 2019 09:55:14 +0000
treeherdermozilla-central@3a3e393396f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1523562, 14819
milestone67.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 1523562 [wpt PR 14819] - Add a test for deleting HTMLCollection properties., a=testonly Automatic update from web-platform-tests Add a test for deleting HTMLCollection properties. -- wpt-commits: 11ed57599f2f0a0ca9be7c1129bf7aa270795f30 wpt-pr: 14819
testing/web-platform/tests/dom/collections/HTMLCollection-delete.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/dom/collections/HTMLCollection-delete.html
@@ -0,0 +1,45 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Deleting properties from HTMLCollection</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<div id=log></div>
+<i id=foo></i>
+<script>
+let c, expected;
+setup(() => {
+  // These might be cached anyway, so explicitly use a single object.
+  c = document.getElementsByTagName("i");
+  expected = document.getElementById("foo");
+});
+
+test(() => {
+  assert_equals(c[0], expected, "before");
+  delete c[0];
+  assert_equals(c[0], expected, "after");
+}, "Loose id");
+
+test(() => {
+  assert_equals(c[0], expected, "before");
+  assert_throws(new TypeError(), function() {
+    "use strict";
+    delete c[0];
+  });
+  assert_equals(c[0], expected, "after");
+}, "Strict id");
+
+test(() => {
+  assert_equals(c.foo, expected, "before");
+  delete c.foo;
+  assert_equals(c.foo, expected, "after");
+}, "Loose name");
+
+test(() => {
+  assert_equals(c.foo, expected, "before");
+  assert_throws(new TypeError(), function() {
+    "use strict";
+    delete c.foo;
+  });
+  assert_equals(c.foo, expected, "after");
+}, "Strict name");
+</script>