[whatwg/dom] Allow elements with a null customElementRegistry without declaratively and without Shadow DOM (Issue #1413)

sorvell created an issue (whatwg/dom#1413)

### What problem are you trying to solve?

Custom element upgrade is currently not easily controllable. When `define` is called on a registry, all elements in document are synchronously upgraded. This can cause issues if upgrades should occur at a specific time and/or not cause a significant performance impact. 

The order of upgrades can also be problematic. While it's brittle to rely on upgrade order, normalizing order between the upgrade case and parser creation case can help improve performance. For example, events are often [used to communicate](https://github.com/webcomponents-cg/community-protocols) between elements and sometimes as a handshake to manage subscriptions / data transfer. Ensuring upgrades occur in tree order rather than define order facilitates this simply.

### What solutions exist today?

The  `<template>` element can be used to prevent element upgrades. However, it does not render elements at all, which is limiting.

Elements can be defined with parser blocking script so that they customize in tree order. However, blocking script before is typically discouraged since it can delay time to interaction.

With the addition of scoped custom elements, a declarative Shadow DOM with a null registry can be used to control upgrade timing and ordering (see [example](https://codepen.io/Steve-Orvell/pen/GgomEVp?editors=1000)). `<div><template shadowrootmode="open" shadowrootcustomelementregistry>...`. Authors can initialize/upgrade the shadowRoot when ready. However, this requires using Shadow DOM, which can be limiting.

### How would you solve it?

1. Allow elements with a `null` `customElementRegistry` to exist in the document scope.
2. Add `customelementregistry` attribute to elements which can have a shadowRoot. This would do the same as `shadowrootcustomelementregistry` on template: assign a null registry.

This would allow authors to control the timing and ordering of custom element upgrade without relying  on declarative Shadow DOM, `<template>`, or blocking scripts.

### Anything else?

_No response_

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/1413
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/issues/1413@github.com>

Received on Thursday, 9 October 2025 16:09:29 UTC