1
0
Fork 0
firefox/testing/web-platform/tests/custom-elements/registries/pseudo-class-defined.window.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

29 lines
1.2 KiB
JavaScript

test(() => {
const otherDocument = new Document();
const element = otherDocument.createElement("blah");
assert_true(element.matches(":defined"));
const registry = new CustomElementRegistry();
registry.initialize(element);
assert_equals(element.customElementRegistry, registry);
assert_true(element.matches(":defined"));
}, `"uncustomized" :defined doesn't care about your registry'`);
test(() => {
const registry = new CustomElementRegistry();
registry.define("sw-r2d2", class extends HTMLElement {});
const element = document.createElement("sw-r2d2", { customElementRegistry: registry });
assert_equals(element.customElementRegistry, registry);
assert_true(element.matches(":defined"));
}, `"custom" :defined doesn't care about your registry`);
test(() => {
const otherDocument = new Document();
const element = otherDocument.createElementNS("http://www.w3.org/1999/xhtml", "sw-r2d2");
assert_false(element.matches(":defined"));
const registry = new CustomElementRegistry();
registry.define("sw-r2d2", class extends HTMLElement {});
registry.initialize(element);
assert_false(element.matches(":defined"));
registry.upgrade(element);
assert_true(element.matches(":defined"));
});