meerk40t / svgelements

SVG Parsing for Elements, Paths, and other SVG Objects.
MIT License
133 stars 29 forks source link

Correctly deal with display="none" #70

Closed tatarize closed 3 years ago

tatarize commented 3 years ago

Since if display="none" the spec says this and all children are not rendered. I should not yield objects that are set to display none.

https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/display

Non-rendered elements are non-returned elements.

tatarize commented 3 years ago

https://www.w3.org/TR/SVG11/painting.html#DisplayProperty

The ‘display’ property only affects the direct rendering of a given element, whereas it does not prevent elements from being referenced by other elements. For example, setting display: none on a ‘path’ element will prevent that element from getting rendered directly onto the canvas, but the ‘path’ element can still be referenced by a ‘textPath’ element; furthermore, its geometry will be used in text-on-a-path processing even if the ‘path’ has display: none.

While the element won't be yielded it will be accessible within the shadow dom.

I need to finish up some slice testing for the svgelements with regard to #69. I'll add this as shortly thereafter.