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

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.

- E

Received on Tuesday, 8 October 2013 17:47:25 UTC