Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 3 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /custom-elements/registries/pseudo-class-defined.window.html - WPT Dashboard Interop Dashboard
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();
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"));
});