Re: [svgwg] Use element re-write & related changes

> The change in styling behavior is waving a red flag in front of my 
eyes. Can you expand on this? We (Inkscape) make heavy use of the 
element. An example would be nice.

The intention is that most cases won't change, except for things like 
`:hover` effects, which are currently a mess in browsers.  But an 
example of a case that _would_ change is as follows:

```
<svg>
  <style>
    svg {stroke-width: 10}
    .special {fill: blue}
    .special circle {stroke: green}
    use {fill: orange; stroke: purple}
  </style>
  <g class="special">
     <circle id="c" cy="50" cx="50" r="40" />
  </g>
  <use xlink:href="#c" x="100" />
</svg>
```

([JSBin demo](http://jsbin.com/pudivoweke/edit?html,output))

In a user agent that strictly conformed to SVG 1.1, the re-used circle
 would be orange with a green stroke.  The original `<circle id="c">` 
element directly matches the `.special circle` rule, so it gets a 
green stroke, but it's fill value is `inherit`.  Those two values are 
then copied to the circle element instance created by the `<use>`, and
 the inherited fill value is then computed as orange.

Under the new model, the copied circle would be orange with purple 
stroke.  The shadow DOM `<circle>` doesn't have an ancestor with class
 "special", so it doesn't match that rule. It inherits both fill and 
stroke.

For what it's worth, Firefox's broken style matching model already 
breaks this (it draws the re-used circle with a purple stroke).  So 
I'm not breaking anything that works cross-browser on the web.  I'm 
also pretty sure that Inkscape and other WYSIWYG software aren't 
creating descendent-selector CSS rules like `.special circle` by 
default, so it's not likely to affect content generated by the 
software internally.

-- 
GitHub Notification of comment by AmeliaBR
Please view or discuss this issue at 
https://github.com/w3c/svgwg/pull/206#issuecomment-234331226 using 
your GitHub account

Received on Thursday, 21 July 2016 17:52:16 UTC