Re: [svgwg] Need to better define what rules apply to an element in an <svg:use> subtree.

The SVG Working Group just discussed `Styling and Use Element shadow trees`.

<details><summary>The full IRC log of that discussion</summary>
&lt;AmeliaBR> Topic: Styling and Use Element shadow trees<br>
&lt;AmeliaBR> Github: https://github.com/w3c/svgwg/issues/504<br>
&lt;AmeliaBR> Dirk: Amelia &amp; I discussed this with Emilio (who posted the issue) over IRC last week.<br>
&lt;AmeliaBR> ... So, the nature of shadow trees is that style selectors from the main document don't match into the shadow tree. In SVG 2 currently, we say to copy the CSS rules into the shadow tree &amp; then match again. But some rules wouldn't match, because the shadow tree is only part of the original tree.<br>
&lt;AmeliaBR> Dirk: This allows the approach to be more consistent with the rest of the web platform, but it doesn't match Edge/Chrome/Safari current behavior.  From discussion, Microsoft in particular was against any change that wasn't backwards compatible.<br>
&lt;AmeliaBR> ... So maybe we can work with people to find a solution that is both consistent with web components and also backwards compatible.<br>
&lt;AmeliaBR> https://svgwg.org/svg2-draft/images/struct/Use-changed-styles.svg<br>
&lt;krit> https://svgwg.org/svg2-draft/struct.html#UseStyleInheritance<br>
&lt;AmeliaBR> That's the example from the spec of a rule that would change between the old or new rules.<br>
&lt;AmeliaBR> Amelia: One thing that has changed since the SVG 2 text was written is we decided to make the use shadow trees closed to author scripts. This gives us room for a little extra magic that can't be defined by regular shadow DOM.<br>
&lt;AmeliaBR> Amelia: The SVG 1 version of cloning the cascaded styles has its own problems. But the break comes specifically from selector matching. So maybe what we need is a little bit of "magic" rules for how selectors match in use-element shadow trees.<br>
&lt;AmeliaBR> ... so if a path element was cloned from somewhere it was a child of a g, then `g > path` would match the shadow path, even though there is no shadow `g`.<br>
&lt;AmeliaBR> ... but interactive selectors like `:hover` would still be assessed on that particular shadow element, not on the original.<br>
&lt;AmeliaBR> Dirk: Is this possible to implement cleanly?<br>
&lt;AmeliaBR> Amelia: It would need special code, but anything that is backwards compatible would need special code, because its unique behavior.<br>
&lt;AmeliaBR> Dirk: Ok. But I think we need a discussion with CSS &amp; web components folks.<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/svgwg/issues/504#issuecomment-434073132 using your GitHub account

Received on Monday, 29 October 2018 20:46:20 UTC