Skip to content

Commit

Permalink
add test for shadowroots falling back to global scope (#46171)
Browse files Browse the repository at this point in the history
  • Loading branch information
keithamus committed May 10, 2024
1 parent ef0e939 commit 27e486c
Showing 1 changed file with 12 additions and 0 deletions.
Expand Up @@ -9,6 +9,9 @@
<div id="testdiv"></div>

<script>
class GloballyScopedElement extends HTMLElement {};
customElements.define('globally-scoped', GloballyScopedElement);

class TestAutonomous extends HTMLElement {};
class TestCustomizedBuiltIn extends HTMLParagraphElement {};

Expand Down Expand Up @@ -113,4 +116,13 @@
assert_false(shadow3.firstChild instanceof TestCustomizedBuiltIn, 'tree scope with different registry');
assert_false(testdiv.firstChild instanceof TestCustomizedBuiltIn, 'main document');
}, 'Upgrade into customized built-in element when definition is added');

test(t => {
const registry = new CustomElementRegistry;

const shadow = attachShadowForTest(t, registry);
shadow.innerHTML = '<globally-scoped></globally-scoped>';
assert_false(shadow.firstChild instanceof GloballyScopedElement, 'is not GloballyScoped');

}, 'Upgrade into autonomous custom element should not inherit from global registry for missing values');
</script>

0 comments on commit 27e486c

Please sign in to comment.