[Webkit-unassigned] [Bug 160038] [Shadow DOM]: :host-context rule does not apply to matching nodes within the shadow root

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jul 22 10:59:30 PDT 2016


https://bugs.webkit.org/show_bug.cgi?id=160038

--- Comment #2 from Chris Joel <cdata at google.com> ---
> The particular example shown here is better served with `text-align: start`.

The RTL example is intended is to demonstrate that it is desirable to conditionally apply styles based on special knowledge of directionality. There may be more than one way to achieve this with text-align, but there is no equivalent for `text-align: start` when using transforms to position an element (for example).

> Using `[dir=rtl]` is not great because there could be an equivalent CSS properties such as `direction: rtl` specified somewhere in the ancestor chain.  It also doesn't take `dir=auto` into account whereas `text-align: start` would work in either case because it uses the computed style to align the text.

Yes, the solution is not perfect for the RTL use case. However, it provides a working strategy to achieve the desired result. If an ancestor node provides a specific indicator for directionality (dir="rtl"), then a component can rely on that indicator and change styles as needed using CSS. I don't know of a declarative way to achieve the same result without :host-context. Is there one?

Would it be helpful to consider an alternate use case? If so, please consider this one: http://output.jsbin.com/qavodi

In the use case, I would like to style an element's Shadow DOM tree in a special way depending on whether or not the element resides within an anchor. The presentation is further specialized if the anchor happens to be configured with target="_blank".

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160722/90f8c27d/attachment.html>


More information about the webkit-unassigned mailing list