tor-browser

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

parser-custom-element-in-foreign-content.html (1203B)


      1 <!DOCTYPE html>
      2 <title>Custom Elements: Custom element in foreign content</title>
      3 <meta name="assert" content="HTML parser should not create non-HTML namespace custom elements">
      4 <link rel="help" href="https://html.spec.whatwg.org/#create-an-element-for-the-token">
      5 <link rel="help" href="https://dom.spec.whatwg.org/#concept-create-element">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 <script>
      9 class ThrowsException extends HTMLElement {
     10  constructor() {
     11    throw 'Bad';
     12  }
     13 };
     14 customElements.define('throws-exception', ThrowsException);
     15 </script>
     16 <svg>
     17  <throws-exception/>
     18 </svg>
     19 <script>
     20 test(function () {
     21  var instance = document.querySelector('throws-exception');
     22  assert_false(instance instanceof ThrowsException,
     23               'The HTML parser must NOT instantiate a custom element in non-HTML namespaces');
     24  assert_false(instance instanceof HTMLUnknownElement, 'The HTML parser should not fallback');
     25  assert_true(instance instanceof SVGElement,
     26              'The element created by the HTML parser must be an instance of SVGElement');
     27 }, 'HTML parser should not create custom elements in non-HTML namespaces');
     28 </script>