cssremedy icon indicating copy to clipboard operation
cssremedy copied to clipboard

svg display attribute ignored

Open ristew opened this issue 3 years ago • 2 comments

Minimum example:

<svg display="none" width="100" height="100">
  <circle cx="50" cy="50" r="50" />
</svg>

workaround:

svg[display="none"] {
  display: none;
}

ristew avatar Dec 21 '21 23:12 ristew

Why not use the global attribute hidden?

SVG

<svg hidden width="100" height="100">
  <circle cx="50" cy="50" r="50" />
</svg>

CSS

svg[hidden] {
  display: none;
}

nucliweb avatar Dec 22 '21 07:12 nucliweb

I made an issue with the library it's coming from: https://github.com/google/blockly/issues/5840. Even display: initial or display: unset triggered the behavior, so I feel it's best to avoid use of the SVG display attribute altogether as it can easily be the victim of undefined behavior.

ristew avatar Dec 22 '21 16:12 ristew