Skip to content

Add new tests for customelementregistry content attribute and specifying null to createEleent and attachShadow per#56108

Merged
rniwa merged 1 commit into
web-platform-tests:masterfrom
rniwa:add-scoped-custom-element-registry-customelementregistry-attribute
Nov 20, 2025
Merged

Add new tests for customelementregistry content attribute and specifying null to createEleent and attachShadow per#56108
rniwa merged 1 commit into
web-platform-tests:masterfrom
rniwa:add-scoped-custom-element-registry-customelementregistry-attribute

Conversation

@rniwa

@rniwa rniwa commented Nov 19, 2025

Copy link
Copy Markdown
Contributor

</head>
<body>
<div id="host-window"><template shadowrootmode="open"><a-b></a-b></template></div>
<div id="host-null"><template shadowrootmode="open" shadowrootcustomelementregistry=""><a-b></a-b></template></div>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was never used in the test.

@rniwa
rniwa force-pushed the add-scoped-custom-element-registry-customelementregistry-attribute branch from 72bf811 to accfde2 Compare November 19, 2025 04:07

@annevk annevk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ja-y-son might also want to review these.

Comment on lines +6 to +7
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

Comment on lines +6 to +7
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

Comment on lines +5 to +6
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

…ing null to createEleent and attachShadow per

- whatwg/dom#1424
- whatwg/dom#1423

Also update the existing tests to account for the behavior differences.`
@rniwa
rniwa force-pushed the add-scoped-custom-element-registry-customelementregistry-attribute branch from accfde2 to 237753b Compare November 19, 2025 17:45
@rniwa rniwa closed this Nov 19, 2025
@rniwa rniwa reopened this Nov 19, 2025
assert_equals(doc.createElement(elementName, {customElementRegistry: null}).customElementRegistry, null);
assert_equals(doc.createElementNS('http://www.w3.org/1999/xhtml', 'div', {customElementRegistry: null}).customElementRegistry, null);
}, `document.createElement should create a ${elementDescription} with null registry if customElement is set to null`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd imagine the test for null registry option on createElement to be placed in Document-createElement.html

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me address these comments in a follow up since the corresponding WebKit change has already landed.

test((test) => {
const [doc, win] = makeIframe(test);
const host = doc.createElement(elementName);
const shadowRoot = host.attachShadow({mode: 'closed', customElementRegistry: null})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto, would imagine this to be placed in ShadowRoot-init-customElementRegistry.html

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to create test cases for cross document append where append does upgrade due to element getting registry on adopt?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A good idea. Will do.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to add tests to ensure the subtree of the element with customelementregistry attribute also has null registry in both HTML and XHTML?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A good idea. Will do.

@rniwa
rniwa merged commit cc1c056 into web-platform-tests:master Nov 20, 2025
35 checks passed
@rniwa
rniwa deleted the add-scoped-custom-element-registry-customelementregistry-attribute branch November 20, 2025 02:06
annevk added a commit to whatwg/dom that referenced this pull request Nov 25, 2025
annevk added a commit to whatwg/dom that referenced this pull request Nov 26, 2025
This makes it possible to have elements with a null custom element registry in a document tree, allowing the registry to be loaded at a later point.

(This commit also fixes a couple minor editorial issues.)

Tests: web-platform-tests/wpt#56108.

Helps with #1413.

Co-authored-by: Anne van Kesteren <annevk@annevk.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants