diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /testing/web-platform/tests/custom-elements/scoped-registry/CustomElementRegistry-constructor.tentative.html | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/custom-elements/scoped-registry/CustomElementRegistry-constructor.tentative.html')
-rw-r--r-- | testing/web-platform/tests/custom-elements/scoped-registry/CustomElementRegistry-constructor.tentative.html | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/testing/web-platform/tests/custom-elements/scoped-registry/CustomElementRegistry-constructor.tentative.html b/testing/web-platform/tests/custom-elements/scoped-registry/CustomElementRegistry-constructor.tentative.html new file mode 100644 index 0000000000..d80a1fbe6c --- /dev/null +++ b/testing/web-platform/tests/custom-elements/scoped-registry/CustomElementRegistry-constructor.tentative.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<meta name="author" title="Xiaocheng Hu" href="mailto:xiaochengh@chromium.org"> +<meta name="assert" content="User code can create non-global CustomElementRegistry instances and add definitions"> +<link rel="help" href="https://wicg.github.io/webcomponents/proposals/Scoped-Custom-Element-Registries"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> +test(() => { + let registry = new CustomElementRegistry(); + assert_not_equals(registry, window.customElements); + + // Define an autonomous element with the new registry. It should not become a + // global definition. + class MyAutonomous extends HTMLElement {}; + registry.define('my-autonomous', MyAutonomous); + assert_equals(registry.get('my-autonomous'), MyAutonomous); + assert_equals(window.customElements.get('my-autonomous'), undefined); + assert_false(document.createElement('my-autonomous') instanceof MyAutonomous); + + // Do the same for a customized built-in element. + class MyCustomizedBuiltIn extends HTMLParagraphElement {}; + registry.define('my-customized-builtin', MyCustomizedBuiltIn, {extends: 'p'}); + assert_equals(registry.get('my-customized-builtin'), MyCustomizedBuiltIn); + assert_equals(window.customElements.get('my-customized-builtin'), undefined); + assert_false(document.createElement('p', {is: 'my-customized-builtin'}) instanceof MyCustomizedBuiltIn); +}, 'Create non-global CustomElementRegistry and add definitions'); +</script> |