Re: [webcomponents]: Allowing text children of ShadowRoot is a bad time

On Oct 8, 2013 1:48 PM, "Elliott Sprehn" <esprehn@gmail.com> wrote:
>
> Direct text children of ShadowRoot are full of sadness:
>
> 1) You can't call getComputedStyle on them since that's only allowed for
Elements, and the old trick of parentNode doesn't work since that's a
ShadowRoot. ShadowRoot doesn't expose a host property so I can't get
outside to find the host style that's inherited either. If the ShadowRoot
has resetStyleInheritance set then the text uses a "root default style",
but I have no way to get that as well.
>
> 2) There's no way to set the style of the Text. Normally I can do
parentNode.style.color = ...; but since ShadowRoot has no style property I
have no way to influence the text of the ShadowRoot without dynamically
changing a <style> element.
>
> 3) You can't use elementFromPoint(). It returns null since
ShadowRoot.elementFromPoint should always return an element in that scope,
but there is no element in that scope. This means you have no sensible way
to do a hit test of the text in the shadow root.

Maybe it's time to reconsider if ShadowRoot should be an element rather
than a DocumentFragment again?

/ Jonas

Received on Wednesday, 9 October 2013 20:55:43 UTC