tor-browser

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

pseudo-class-defined.window.js (1201B)


      1 test(() => {
      2  const otherDocument = new Document();
      3  const element = otherDocument.createElement("blah");
      4  assert_true(element.matches(":defined"));
      5  const registry = new CustomElementRegistry();
      6  registry.initialize(element);
      7  assert_equals(element.customElementRegistry, registry);
      8  assert_true(element.matches(":defined"));
      9 }, `"uncustomized" :defined doesn't care about your registry'`);
     10 
     11 test(() => {
     12  const registry = new CustomElementRegistry();
     13  registry.define("sw-r2d2", class extends HTMLElement {});
     14  const element = document.createElement("sw-r2d2", { customElementRegistry: registry });
     15  assert_equals(element.customElementRegistry, registry);
     16  assert_true(element.matches(":defined"));
     17 }, `"custom" :defined doesn't care about your registry`);
     18 
     19 test(() => {
     20  const otherDocument = new Document();
     21  const element = otherDocument.createElementNS("http://www.w3.org/1999/xhtml", "sw-r2d2");
     22  assert_false(element.matches(":defined"));
     23  const registry = new CustomElementRegistry();
     24  registry.define("sw-r2d2", class extends HTMLElement {});
     25  registry.initialize(element);
     26  assert_true(element.matches(":defined"));
     27 }, `"custom" :defined should apply after initialize`);