Re: [svgwg] Add support for the `hidden`-attribute

`display` works as an SVG presentation attribute, right? So the question of precedence is interesting:

```svg
<g hidden display="inline">
  …
</g>
```

The straightforward answer is probably(?) that `hidden` overrides `display="inline"`, since CSS is more specific than presentation attributes. I think this is simpler from an author perspective, since if they use a library like Normalize.css or their own styles for `[hidden] { display: none }`, that could produce a weird effect where the order-of-precedence differs depending on native support, especially if the author opts not to serve certain “polyfills” to newer browsers.

`hidden` is mostly useful for DOM scripting in my experience, where you don’t care what an element’s `display` value _should_ be — you just want to toggle it on and off. This especially seems to catch SVG authors — technically `display: block` _should_ result in a shown element, but but I keep getting bit by edge cases with stuff like CSS animations where it expects `display: inline` instead. Most show/hide snippets on StackOverflow (et al.) toggle elements between `display:block/none`, so I’d would like to see `hidden` parity between SVG and HTML to simplify future show/hide scripts.

-- 
GitHub Notification of comment by tigt
Please view or discuss this issue at https://github.com/w3c/svgwg/issues/508#issuecomment-411974213 using your GitHub account

Received on Friday, 10 August 2018 04:47:59 UTC