Allow the creation of null registry element and shadow root [chromium/src : main]

0 views
Skip to first unread message

YeongHan Kim (Gerrit)

unread,
Dec 6, 2025, 9:30:00 AM (11 days ago) Dec 6
to AyeAye, Jayson Chen, Mason Freed, Chromium LUCI CQ, chromium...@chromium.org, mac-r...@chromium.org, dom+...@chromium.org, dominicc+...@chromium.org, hiroshig...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org, kouhei...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org
Attention needed from Jayson Chen and Mason Freed

YeongHan Kim added 1 comment

Patchset-level comments
File-level comment, Patchset 19 (Latest):
YeongHan Kim . resolved

Sorry for the delay.
Please review it when you get a chance. Thanks!

Open in Gerrit

Related details

Attention is currently required from:
  • Jayson Chen
  • Mason Freed
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I14c2638d779b947d0486a154b062b722073c4089
Gerrit-Change-Number: 7198720
Gerrit-PatchSet: 19
Gerrit-Owner: YeongHan Kim <soosu...@gmail.com>
Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
Gerrit-Reviewer: YeongHan Kim <soosu...@gmail.com>
Gerrit-Attention: Jayson Chen <jayso...@microsoft.com>
Gerrit-Attention: Mason Freed <mas...@chromium.org>
Gerrit-Comment-Date: Sat, 06 Dec 2025 14:29:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Jayson Chen (Gerrit)

unread,
Dec 8, 2025, 9:52:24 AM (9 days ago) Dec 8
to YeongHan Kim, AyeAye, Mason Freed, Chromium LUCI CQ, chromium...@chromium.org, mac-r...@chromium.org, dom+...@chromium.org, dominicc+...@chromium.org, hiroshig...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org, kouhei...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org
Attention needed from Mason Freed and YeongHan Kim

Jayson Chen voted and added 2 comments

Votes added by Jayson Chen

Code-Review+1

2 comments

Patchset-level comments
Jayson Chen . resolved

Overall looks good to me! Thanks for making the change.

File third_party/blink/renderer/core/dom/document.cc
Line 1606, Patchset 19 (Latest): const bool wait_for_registry) {
Jayson Chen . unresolved

Do we still need this argument? (Correct me if I'm wrong) In the default registry scenario (registry not provided to `CreateElement`), if we get null by looking up document's custom element registry by calling `customElementRegistry()`, we do want to set null registry to the element right?
Is it possible to remove this argument, and in line 1632 below use `!registry` for the argument for `CreateUncustomizedOrUndefinedElement`?

Open in Gerrit

Related details

Attention is currently required from:
  • Mason Freed
  • YeongHan Kim
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I14c2638d779b947d0486a154b062b722073c4089
    Gerrit-Change-Number: 7198720
    Gerrit-PatchSet: 19
    Gerrit-Owner: YeongHan Kim <soosu...@gmail.com>
    Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-Reviewer: YeongHan Kim <soosu...@gmail.com>
    Gerrit-Attention: Mason Freed <mas...@chromium.org>
    Gerrit-Attention: YeongHan Kim <soosu...@gmail.com>
    Gerrit-Comment-Date: Mon, 08 Dec 2025 14:51:48 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    YeongHan Kim (Gerrit)

    unread,
    Dec 9, 2025, 10:54:10 AM (7 days ago) Dec 9
    to Jayson Chen, AyeAye, Mason Freed, Chromium LUCI CQ, chromium...@chromium.org, mac-r...@chromium.org, dom+...@chromium.org, dominicc+...@chromium.org, hiroshig...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org, kouhei...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org
    Attention needed from Jayson Chen and Mason Freed

    YeongHan Kim added 2 comments

    Patchset-level comments
    File-level comment, Patchset 20 (Latest):
    YeongHan Kim . resolved

    Thank you so much for reviewing this!

    File third_party/blink/renderer/core/dom/document.cc
    Line 1606, Patchset 19: const bool wait_for_registry) {
    Jayson Chen . resolved

    Do we still need this argument? (Correct me if I'm wrong) In the default registry scenario (registry not provided to `CreateElement`), if we get null by looking up document's custom element registry by calling `customElementRegistry()`, we do want to set null registry to the element right?
    Is it possible to remove this argument, and in line 1632 below use `!registry` for the argument for `CreateUncustomizedOrUndefinedElement`?

    YeongHan Kim

    Oh! I had thought it needed to be set only when `ElementCreationOptions` included a registry, but it seems I misunderstood.

    You’re right, and it looks like we can remove both the `wait_for_registry` argument and the extra `CreateElement()` overload.

    Thanks!

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Jayson Chen
    • Mason Freed
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I14c2638d779b947d0486a154b062b722073c4089
      Gerrit-Change-Number: 7198720
      Gerrit-PatchSet: 20
      Gerrit-Owner: YeongHan Kim <soosu...@gmail.com>
      Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
      Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
      Gerrit-Reviewer: YeongHan Kim <soosu...@gmail.com>
      Gerrit-Attention: Jayson Chen <jayso...@microsoft.com>
      Gerrit-Attention: Mason Freed <mas...@chromium.org>
      Gerrit-Comment-Date: Tue, 09 Dec 2025 15:53:37 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Jayson Chen <jayso...@microsoft.com>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Jayson Chen (Gerrit)

      unread,
      Dec 10, 2025, 11:50:54 AM (6 days ago) Dec 10
      to YeongHan Kim, AyeAye, Mason Freed, Chromium LUCI CQ, chromium...@chromium.org, mac-r...@chromium.org, dom+...@chromium.org, dominicc+...@chromium.org, hiroshig...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org, kouhei...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org
      Attention needed from Mason Freed and YeongHan Kim

      Jayson Chen voted and added 4 comments

      Votes added by Jayson Chen

      Code-Review+1

      4 comments

      Patchset-level comments
      Jayson Chen . resolved

      LGTM with few nits. Thanks!

      File third_party/blink/renderer/core/dom/document.cc
      Line 1587, Patchset 20 (Latest):Element* Document::CreateElement(const QualifiedName& q_name,
      Jayson Chen . unresolved

      nit: can we get a comment explaining this overload behavior of "not providing registry in arg (default case) so use document's registry?

      Line 1600, Patchset 20 (Latest): // 2. If registry is "default", set registry to the result of looking
      // up a custom element registry given document.
      Jayson Chen . unresolved

      nit: can we also have these lines in the overload function? Since that is the entry point for "registry is default"

      Line 1602, Patchset 20 (Latest): // Note that this step is currently only applicable to scenario when
      // scoped registry is disabled as a valid registry should be assigned for
      // default cases while flattening options.
      Jayson Chen . unresolved

      nit: Prob not entirely accurate now, perhaps something along the line of
      "Note that we need to assign default registry when scoped registry is disabled"
      to explain the following line of code.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Mason Freed
      • YeongHan Kim
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I14c2638d779b947d0486a154b062b722073c4089
        Gerrit-Change-Number: 7198720
        Gerrit-PatchSet: 20
        Gerrit-Owner: YeongHan Kim <soosu...@gmail.com>
        Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
        Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
        Gerrit-Reviewer: YeongHan Kim <soosu...@gmail.com>
        Gerrit-Attention: Mason Freed <mas...@chromium.org>
        Gerrit-Attention: YeongHan Kim <soosu...@gmail.com>
        Gerrit-Comment-Date: Wed, 10 Dec 2025 16:50:16 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Mason Freed (Gerrit)

        unread,
        Dec 10, 2025, 6:43:23 PM (6 days ago) Dec 10
        to YeongHan Kim, Jayson Chen, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, mac-r...@chromium.org, dom+...@chromium.org, dominicc+...@chromium.org, hiroshig...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org, kouhei...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org
        Attention needed from YeongHan Kim

        Mason Freed voted and added 6 comments

        Votes added by Mason Freed

        Code-Review+1

        6 comments

        Patchset-level comments
        Mason Freed . resolved

        LGTM, thanks for working on this bug! I do have a few nits, but nothing major I think.

        File third_party/blink/renderer/core/dom/document.h
        Line 523, Patchset 20 (Latest): Element* CreateElement(const QualifiedName&,
        const CreateElementFlags,
        const AtomicString& is);
        Mason Freed . unresolved

        I think it might (might!) be better *not* to add this overload, and instead explicitly pass in the registry argument? There are 12 callers or so, which isn't too many. I'm just concerned that all callers really should be thinking about custom element registries, rather than perhaps accidentally relying on the default behavior.

        File third_party/blink/renderer/core/dom/document.cc
        Line 1431, Patchset 20 (Latest): // 3-1. If options["is"] exists, then set is to it.
        Mason Freed . unresolved

        `"is"` - see comment below

        Line 1443, Patchset 20 (Latest): "The custom element registry and is option can't be set at the "
        Mason Freed . unresolved

        Perhaps `and "is" option` (with quotation marks) or something? It's too bad "is" is the name of this thing, it makes writing it down confusing.

        Line 1587, Patchset 20 (Latest):Element* Document::CreateElement(const QualifiedName& q_name,
        Jayson Chen . unresolved

        nit: can we get a comment explaining this overload behavior of "not providing registry in arg (default case) so use document's registry?

        Mason Freed

        ...also, I think it'd be easier to read if this overload were defined in the `.h` file instead.

        Line 1624, Patchset 20 (Latest): *this, q_name, flags, is, registry, !registry);
        Mason Freed . unresolved

        nit: `, /*wait_for_registry*/ !registry)`

        Open in Gerrit

        Related details

        Attention is currently required from:
        • YeongHan Kim
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement satisfiedCode-Owners
        • requirement satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I14c2638d779b947d0486a154b062b722073c4089
        Gerrit-Change-Number: 7198720
        Gerrit-PatchSet: 20
        Gerrit-Owner: YeongHan Kim <soosu...@gmail.com>
        Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
        Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
        Gerrit-Reviewer: YeongHan Kim <soosu...@gmail.com>
        Gerrit-Attention: YeongHan Kim <soosu...@gmail.com>
        Gerrit-Comment-Date: Wed, 10 Dec 2025 23:43:06 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        Comment-In-Reply-To: Jayson Chen <jayso...@microsoft.com>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Jayson Chen (Gerrit)

        unread,
        Dec 10, 2025, 10:00:21 PM (6 days ago) Dec 10
        to YeongHan Kim, Mason Freed, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, mac-r...@chromium.org, dom+...@chromium.org, dominicc+...@chromium.org, hiroshig...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org, kouhei...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org
        Attention needed from YeongHan Kim

        Jayson Chen added 1 comment

        File third_party/blink/renderer/core/dom/document.h
        Line 523, Patchset 20 (Latest): Element* CreateElement(const QualifiedName&,
        const CreateElementFlags,
        const AtomicString& is);
        Mason Freed . unresolved

        I think it might (might!) be better *not* to add this overload, and instead explicitly pass in the registry argument? There are 12 callers or so, which isn't too many. I'm just concerned that all callers really should be thinking about custom element registries, rather than perhaps accidentally relying on the default behavior.

        Jayson Chen

        I’d argue that we need the overload for default case bc

        • The spec does outline that create element could have a registry given, null or default as registry. Without overloading, we’re not able to differentiate the implicit null (default case) or explicit null (actually want null case) without introducing another argument asking if null is explicit or implicit. I find overloading here clearer and less confusing than having another argument like wait_for_registry. Patch 7 demonstrates what it’s like if we don’t do overload but have another argument.
        • Correct me if I’m wrong, it feels like it is actually the desired behavior to use default registry, unless the caller explicitly wants the registry to specified, so I wouldn’t worry too much about relying on the default behavior.

        But ofc open to thoughts and discussions :)

        Gerrit-Comment-Date: Thu, 11 Dec 2025 02:59:52 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Mason Freed <mas...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        YeongHan Kim (Gerrit)

        unread,
        Dec 11, 2025, 9:32:20 AM (6 days ago) Dec 11
        to Jayson Chen, Mason Freed, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, mac-r...@chromium.org, dom+...@chromium.org, dominicc+...@chromium.org, hiroshig...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org, kouhei...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org
        Attention needed from Jayson Chen and Mason Freed

        YeongHan Kim added 8 comments

        Patchset-level comments
        File-level comment, Patchset 21 (Latest):
        YeongHan Kim . resolved

        Thanks for the review!
        I’ve applied the nit suggestions, and I’ve also shared some of my thoughts in the discussion.

        File third_party/blink/renderer/core/dom/document.h
        Line 523, Patchset 20: Element* CreateElement(const QualifiedName&,

        const CreateElementFlags,
        const AtomicString& is);
        Mason Freed . unresolved

        I think it might (might!) be better *not* to add this overload, and instead explicitly pass in the registry argument? There are 12 callers or so, which isn't too many. I'm just concerned that all callers really should be thinking about custom element registries, rather than perhaps accidentally relying on the default behavior.

        Jayson Chen

        I’d argue that we need the overload for default case bc

        • The spec does outline that create element could have a registry given, null or default as registry. Without overloading, we’re not able to differentiate the implicit null (default case) or explicit null (actually want null case) without introducing another argument asking if null is explicit or implicit. I find overloading here clearer and less confusing than having another argument like wait_for_registry. Patch 7 demonstrates what it’s like if we don’t do overload but have another argument.
        • Correct me if I’m wrong, it feels like it is actually the desired behavior to use default registry, unless the caller explicitly wants the registry to specified, so I wouldn’t worry too much about relying on the default behavior.

        But ofc open to thoughts and discussions :)

        YeongHan Kim

        Thank you for the helpful thoughts!
        I’d like to share my thoughts as well, though cautiously.

        When the registry is not explicitly provided (implicit null), we previously passed nullptr, but now it has been changed so that we pass the default (`customElementRegistry()`) instead.

        Based on that, the way I understand Mason’s suggestion is that instead of using an overload, we could explicitly pass the default registry. In that case, unlike Patch 7, we wouldn’t need an additional argument

        That said, even so, when the registry isn’t explicitly provided, I feel it’s cleaner to rely on the default behavior through an overload rather than requiring callers to explicitly pass the default registry

        File third_party/blink/renderer/core/dom/document.cc
        Line 1431, Patchset 20: // 3-1. If options["is"] exists, then set is to it.
        Mason Freed . resolved

        `"is"` - see comment below

        YeongHan Kim

        Done!

        Line 1443, Patchset 20: "The custom element registry and is option can't be set at the "
        Mason Freed . resolved

        Perhaps `and "is" option` (with quotation marks) or something? It's too bad "is" is the name of this thing, it makes writing it down confusing.

        YeongHan Kim

        Done!

        Line 1587, Patchset 20:Element* Document::CreateElement(const QualifiedName& q_name,
        Jayson Chen . resolved

        nit: can we get a comment explaining this overload behavior of "not providing registry in arg (default case) so use document's registry?

        Mason Freed

        ...also, I think it'd be easier to read if this overload were defined in the `.h` file instead.

        YeongHan Kim

        I’ve added the comment to the `.h` file. Thanks!

        Line 1600, Patchset 20: // 2. If registry is "default", set registry to the result of looking

        // up a custom element registry given document.
        Jayson Chen . resolved

        nit: can we also have these lines in the overload function? Since that is the entry point for "registry is default"

        YeongHan Kim

        Done!

        Line 1602, Patchset 20: // Note that this step is currently only applicable to scenario when

        // scoped registry is disabled as a valid registry should be assigned for
        // default cases while flattening options.
        Jayson Chen . resolved

        nit: Prob not entirely accurate now, perhaps something along the line of
        "Note that we need to assign default registry when scoped registry is disabled"
        to explain the following line of code.

        YeongHan Kim

        Done!

        Line 1624, Patchset 20: *this, q_name, flags, is, registry, !registry);
        Mason Freed . resolved

        nit: `, /*wait_for_registry*/ !registry)`

        YeongHan Kim

        Done!

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Jayson Chen
        • Mason Freed
        Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement satisfiedCode-Owners
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I14c2638d779b947d0486a154b062b722073c4089
          Gerrit-Change-Number: 7198720
          Gerrit-PatchSet: 21
          Gerrit-Owner: YeongHan Kim <soosu...@gmail.com>
          Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
          Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
          Gerrit-Reviewer: YeongHan Kim <soosu...@gmail.com>
          Gerrit-Attention: Jayson Chen <jayso...@microsoft.com>
          Gerrit-Attention: Mason Freed <mas...@chromium.org>
          Gerrit-Comment-Date: Thu, 11 Dec 2025 14:31:44 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          Comment-In-Reply-To: Jayson Chen <jayso...@microsoft.com>
          Comment-In-Reply-To: Mason Freed <mas...@chromium.org>
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Jayson Chen (Gerrit)

          unread,
          Dec 11, 2025, 12:21:04 PM (5 days ago) Dec 11
          to YeongHan Kim, Mason Freed, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, mac-r...@chromium.org, dom+...@chromium.org, dominicc+...@chromium.org, hiroshig...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org, kouhei...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org
          Attention needed from Mason Freed and YeongHan Kim

          Jayson Chen voted and added 1 comment

          Votes added by Jayson Chen

          Code-Review+1

          1 comment

          File third_party/blink/renderer/core/dom/document.h
          Line 523, Patchset 20: Element* CreateElement(const QualifiedName&,
          const CreateElementFlags,
          const AtomicString& is);
          Mason Freed . unresolved

          I think it might (might!) be better *not* to add this overload, and instead explicitly pass in the registry argument? There are 12 callers or so, which isn't too many. I'm just concerned that all callers really should be thinking about custom element registries, rather than perhaps accidentally relying on the default behavior.

          Jayson Chen

          I’d argue that we need the overload for default case bc

          • The spec does outline that create element could have a registry given, null or default as registry. Without overloading, we’re not able to differentiate the implicit null (default case) or explicit null (actually want null case) without introducing another argument asking if null is explicit or implicit. I find overloading here clearer and less confusing than having another argument like wait_for_registry. Patch 7 demonstrates what it’s like if we don’t do overload but have another argument.
          • Correct me if I’m wrong, it feels like it is actually the desired behavior to use default registry, unless the caller explicitly wants the registry to specified, so I wouldn’t worry too much about relying on the default behavior.

          But ofc open to thoughts and discussions :)

          YeongHan Kim

          Thank you for the helpful thoughts!
          I’d like to share my thoughts as well, though cautiously.

          When the registry is not explicitly provided (implicit null), we previously passed nullptr, but now it has been changed so that we pass the default (`customElementRegistry()`) instead.

          Based on that, the way I understand Mason’s suggestion is that instead of using an overload, we could explicitly pass the default registry. In that case, unlike Patch 7, we wouldn’t need an additional argument

          That said, even so, when the registry isn’t explicitly provided, I feel it’s cleaner to rely on the default behavior through an overload rather than requiring callers to explicitly pass the default registry

          Jayson Chen

          Ah yes that makes sense that we wouldn't need an additional argument then. With that in mind, I still slightly lean towards having the overload function as default registry case is explicitly stated in the spec, but I don't feel as strongly about it as before. I guess the question will come down to, moving forward for all the create element caller who don't care about custom element registry, should we expect them to know that they should pass in `document->customElementRegistry()` as the default value? Or we want to offload that responsibility of knowing registry to the overload function.

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Mason Freed
          • YeongHan Kim
          Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement satisfiedCode-Owners
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I14c2638d779b947d0486a154b062b722073c4089
          Gerrit-Change-Number: 7198720
          Gerrit-PatchSet: 21
          Gerrit-Owner: YeongHan Kim <soosu...@gmail.com>
          Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
          Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
          Gerrit-Reviewer: YeongHan Kim <soosu...@gmail.com>
          Gerrit-Attention: Mason Freed <mas...@chromium.org>
          Gerrit-Attention: YeongHan Kim <soosu...@gmail.com>
          Gerrit-Comment-Date: Thu, 11 Dec 2025 17:20:32 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          Comment-In-Reply-To: Jayson Chen <jayso...@microsoft.com>
          Comment-In-Reply-To: Mason Freed <mas...@chromium.org>
          Comment-In-Reply-To: YeongHan Kim <soosu...@gmail.com>
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          YeongHan Kim (Gerrit)

          unread,
          Dec 15, 2025, 4:58:32 AM (yesterday) Dec 15
          to Jayson Chen, Mason Freed, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, mac-r...@chromium.org, dom+...@chromium.org, dominicc+...@chromium.org, hiroshig...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org, kouhei...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org
          Attention needed from Mason Freed

          YeongHan Kim added 1 comment

          Patchset-level comments
          YeongHan Kim . resolved

          gentle ping @mas...@chromium.org

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Mason Freed
          Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement satisfiedCode-Owners
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I14c2638d779b947d0486a154b062b722073c4089
          Gerrit-Change-Number: 7198720
          Gerrit-PatchSet: 21
          Gerrit-Owner: YeongHan Kim <soosu...@gmail.com>
          Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
          Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
          Gerrit-Reviewer: YeongHan Kim <soosu...@gmail.com>
          Gerrit-Attention: Mason Freed <mas...@chromium.org>
          Gerrit-Comment-Date: Mon, 15 Dec 2025 09:57:58 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Mason Freed (Gerrit)

          unread,
          Dec 15, 2025, 12:31:12 PM (yesterday) Dec 15
          to YeongHan Kim, Jayson Chen, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, mac-r...@chromium.org, dom+...@chromium.org, dominicc+...@chromium.org, hiroshig...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org, kouhei...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org
          Attention needed from YeongHan Kim

          Mason Freed added 1 comment

          File third_party/blink/renderer/core/dom/document.h
          Line 523, Patchset 20: Element* CreateElement(const QualifiedName&,
          const CreateElementFlags,
          const AtomicString& is);
          Mason Freed . unresolved

          I think it might (might!) be better *not* to add this overload, and instead explicitly pass in the registry argument? There are 12 callers or so, which isn't too many. I'm just concerned that all callers really should be thinking about custom element registries, rather than perhaps accidentally relying on the default behavior.

          Jayson Chen

          I’d argue that we need the overload for default case bc

          • The spec does outline that create element could have a registry given, null or default as registry. Without overloading, we’re not able to differentiate the implicit null (default case) or explicit null (actually want null case) without introducing another argument asking if null is explicit or implicit. I find overloading here clearer and less confusing than having another argument like wait_for_registry. Patch 7 demonstrates what it’s like if we don’t do overload but have another argument.
          • Correct me if I’m wrong, it feels like it is actually the desired behavior to use default registry, unless the caller explicitly wants the registry to specified, so I wouldn’t worry too much about relying on the default behavior.

          But ofc open to thoughts and discussions :)

          YeongHan Kim

          Thank you for the helpful thoughts!
          I’d like to share my thoughts as well, though cautiously.

          When the registry is not explicitly provided (implicit null), we previously passed nullptr, but now it has been changed so that we pass the default (`customElementRegistry()`) instead.

          Based on that, the way I understand Mason’s suggestion is that instead of using an overload, we could explicitly pass the default registry. In that case, unlike Patch 7, we wouldn’t need an additional argument

          That said, even so, when the registry isn’t explicitly provided, I feel it’s cleaner to rely on the default behavior through an overload rather than requiring callers to explicitly pass the default registry

          Jayson Chen

          Ah yes that makes sense that we wouldn't need an additional argument then. With that in mind, I still slightly lean towards having the overload function as default registry case is explicitly stated in the spec, but I don't feel as strongly about it as before. I guess the question will come down to, moving forward for all the create element caller who don't care about custom element registry, should we expect them to know that they should pass in `document->customElementRegistry()` as the default value? Or we want to offload that responsibility of knowing registry to the overload function.

          Mason Freed

          My concern here is confusion and bugs in future code. Since there are explicitly three choices:

           - Implicit null
          - Explicit null
          - Explicit non-null registry

          these three choices need to be apparent in the interface. Right now, there are two overloads, and one of them chooses one of these choices without it being obvious. For example, imagine [this method](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/svg/svg_script_element.cc;l=205;drc=13c2ee3faddbad7baed3819883d2c6438fe01247) were being added *after* this change lands. It might have been possible then, for the author to just not add the fourth argument, and miss that now SVG scripts would not properly construct elements with the right registry. That's bad, right? That relies on tests to catch such bugs, and it relies on the author of the change to know that there's a possible interaction that they might need to add a test for. If nothing breaks when they add it, they'll likely not even notice that there is an interaction.

          So based on that, I'm still in favor of requiring the `registry` argument, and I think further we should have a static method on CustomElementRegistry called `CustomElementRegistry::ImplicitNullRegistry()` or similar, which is the one used where that makes sense. That feels easier to understand than just passing `customElementRegistry()`, because "customElementRegistry()" doesn't tell me what this means "implicit registry". I agree with the above that the two argument approach is a hassle. But this method still makes the choice explicit at the call site, rather than implicit.

          I'm still open to being talked out of this, so let me know what I'm missing here. I.e. let's discuss before you make a big change to the API again. I want to avoid making you go through the pain if I've got the wrong idea here.

          Open in Gerrit

          Related details

          Attention is currently required from:
          • YeongHan Kim
          Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement satisfiedCode-Owners
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I14c2638d779b947d0486a154b062b722073c4089
          Gerrit-Change-Number: 7198720
          Gerrit-PatchSet: 21
          Gerrit-Owner: YeongHan Kim <soosu...@gmail.com>
          Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
          Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
          Gerrit-Reviewer: YeongHan Kim <soosu...@gmail.com>
          Gerrit-Attention: YeongHan Kim <soosu...@gmail.com>
          Gerrit-Comment-Date: Mon, 15 Dec 2025 17:31:01 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          YeongHan Kim (Gerrit)

          unread,
          7:33 AM (15 hours ago) 7:33 AM
          to Jayson Chen, Mason Freed, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, mac-r...@chromium.org, dom+...@chromium.org, dominicc+...@chromium.org, hiroshig...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org, kouhei...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org
          Attention needed from Jayson Chen and Mason Freed

          YeongHan Kim added 1 comment

          File third_party/blink/renderer/core/dom/document.h

          Thank you for the detailed explanation!
          I agree with your point.

          What do you think, Jayson?

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Jayson Chen
          • Mason Freed
          Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement satisfiedCode-Owners
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I14c2638d779b947d0486a154b062b722073c4089
          Gerrit-Change-Number: 7198720
          Gerrit-PatchSet: 21
          Gerrit-Owner: YeongHan Kim <soosu...@gmail.com>
          Gerrit-Reviewer: Jayson Chen <jayso...@microsoft.com>
          Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
          Gerrit-Reviewer: YeongHan Kim <soosu...@gmail.com>
          Gerrit-Attention: Jayson Chen <jayso...@microsoft.com>
          Gerrit-Attention: Mason Freed <mas...@chromium.org>
          Gerrit-Comment-Date: Tue, 16 Dec 2025 12:33:24 +0000
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy
          Reply all
          Reply to author
          Forward
          0 new messages