tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

insert_adjacent_html.js (1521B)


      1 function testThrowingNoParent(element, desc) {
      2  test(function() {
      3    assert_throws_dom("NO_MODIFICATION_ALLOWED_ERR",
      4      function() { element.insertAdjacentHTML("afterend", "") }
      5    );
      6    assert_throws_dom("NO_MODIFICATION_ALLOWED_ERR",
      7      function() { element.insertAdjacentHTML("beforebegin", "") }
      8    );
      9    assert_throws_dom("NO_MODIFICATION_ALLOWED_ERR",
     10      function() { element.insertAdjacentHTML("afterend", "foo") }
     11    );
     12    assert_throws_dom("NO_MODIFICATION_ALLOWED_ERR",
     13      function() { element.insertAdjacentHTML("beforebegin", "foo") }
     14    );
     15  }, "When the parent node is " + desc + ", insertAdjacentHTML should throw for beforebegin and afterend (text)");
     16  test(function() {
     17    assert_throws_dom("NO_MODIFICATION_ALLOWED_ERR",
     18      function() { element.insertAdjacentHTML("afterend", "<!-- fail -->") }
     19    );
     20    assert_throws_dom("NO_MODIFICATION_ALLOWED_ERR",
     21      function() { element.insertAdjacentHTML("beforebegin", "<!-- fail -->") }
     22    );
     23  }, "When the parent node is " + desc + ", insertAdjacentHTML should throw for beforebegin and afterend (comments)");
     24  test(function() {
     25    assert_throws_dom("NO_MODIFICATION_ALLOWED_ERR",
     26      function() { element.insertAdjacentHTML("afterend", "<div></div>") }
     27    );
     28    assert_throws_dom("NO_MODIFICATION_ALLOWED_ERR",
     29      function() { element.insertAdjacentHTML("beforebegin", "<div></div>") }
     30    );
     31  }, "When the parent node is " + desc + ", insertAdjacentHTML should throw for beforebegin and afterend (elements)");
     32 }