Re: [WICG/webcomponents] [Scoped registry] Clarify relationship with shadow roots (PR #965)

@sashafirsov commented on this pull request.



> +### Note on light DOM custom elements
+
+Custom elements that use light DOM (i.e. that don't call `this.attachShadow()`) may be scoped, but they must be scoped within a shadow root. For example:
+
+```html
+<body>
+  <shadow-element>
+    #shadow-root (registry=myCustomRegistry)
+      <light-element>
+        <div>Light DOM</div>
+      </light-element>
+  </shadow-element>
+</body>
+```
+
+In the above example, `<light-element>` is scoped within the shadow root of its containing `<shadow-element>`, whereas `<shadow-element>` is defined at the global document level.

Should we reflect that scope could be more flexible and tied not just to shadowRoot?

There is a scenario when `light-element` would have declarative custom element definition inside which would be logical to scope to the parent (or somehow named scope) instead whole page. 


```html
<body>
  <light-element>
    #light-root (registry=myCustomRegistry)
      <definition tag="custom-element>...</definition><!-- syntax is not clear as of now -->
      <custom-element>
        <div>Light DOM</div>
      </custom-element>
  </light-element>
</body>
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/pull/965#pullrequestreview-1068880591
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/pull/965/review/1068880591@github.com>

Received on Wednesday, 10 August 2022 20:19:14 UTC