From aca19e2df45dc7cb2043d98ceaa3e9439ae542fd Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Wed, 8 Jul 2026 08:37:54 +0200 Subject: [PATCH 1/2] Clarify create an element assertion Instead of saying "initialized" let's enumerate what these values can actually be and provide an example of something that is potentially unexpected. Fixes #1338. --- dom.bs | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/dom.bs b/dom.bs index a4b6e4b0..c450b64e 100644 --- a/dom.bs +++ b/dom.bs @@ -6954,8 +6954,30 @@ null, or a {{CustomElementRegistry}} object registry (default "
  • Set result to the result of constructing C, with no arguments. -

  • Assert: result's custom element state and - custom element definition are initialized. +

  • +

    Assert: result's custom element state is + "custom" and its custom element definition is non-null, + result's custom element state is "precustomized", + or result's custom element state is neither + "custom" nor "precustomized" and its + custom element definition is null. + +

    +
    
    +          customElements.define("x-example", class extends HTMLElement {
    +            constructor() {
    +              // Non-conformant: returns an existing element instead of calling super().
    +              return document.createElement("p");
    +            }
    +          });
    +
    +          document.createElement("x-example");
    +         
    + +

    Here result is the p element, whose + custom element state is "uncustomized" and whose + custom element definition is null. +

  • Assert: result's namespace is the HTML namespace. From ef96cc88353ad1bec4bddaec33e0420b92527b9e Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Wed, 15 Jul 2026 15:40:11 +0200 Subject: [PATCH 2/2] use a list --- dom.bs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/dom.bs b/dom.bs index c450b64e..2ec90fca 100644 --- a/dom.bs +++ b/dom.bs @@ -6955,12 +6955,17 @@ null, or a {{CustomElementRegistry}} object registry (default " arguments.

  • -

    Assert: result's custom element state is - "custom" and its custom element definition is non-null, - result's custom element state is "precustomized", - or result's custom element state is neither - "custom" nor "precustomized" and its - custom element definition is null. +

    Assert: one of the following is true: + +