Skip to content

[proposal] Node.containingShadowRoot #826

@emilio

Description

@emilio

I think this would be useful for authors that want to write Shadow-DOM aware code.

All browser engines have a way to get a hand to the subtree root and check if it's a shadow root in one way or another.

Gecko: https://searchfox.org/mozilla-central/rev/2e355fa82aaa87e8424a9927c8136be184eeb6c7/dom/base/nsINode.cpp#699

WebKit: https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/dom/Node.cpp?rev=+254087#L1127

Chromium: https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/dom/node.cc;l=1815;drc=95e78e2d51fce9616e316073be6b2b92189e21ee

How do folks feel about this? Maybe it should just be in Element and Text or something...

cc @whatwg/components

Metadata

Metadata

Assignees

No one assigned

    Labels

    addition/proposalNew features or enhancementsneeds implementer interestMoving the issue forward requires implementers to express interesttopic: shadowRelates to shadow trees (as defined in DOM)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions