ampproject/amp-toolbox-php

Add more support for SVG related self-closing tags in Document filter

ediamin opened this issue · 2 comments

There are many empty elements in SVG than just circle, g and path tags. For example:

  • use
  • rect
  • image
  • polygon
  • ellipse
  • etc

Technically in SVG (as XML), any element can be self-closing, even if they aren't defined as empty (e.g. g).

Should this not be comprehensive? Or is it exclusively just to make the tests pass?

cf. ampproject/amp-wp#6657 (comment)

Originally posted by @westonruter in #210 (comment)

If browsers properly handle the parsing of self-closing SVG tags in HTML the same way as empty SVG tags, then I suppose there's no need to go further here.

Yes, there's no technical need from the browser's point of view. But for the sake of consistency and for being able to build reliable tests against anything that includes SVGs, it would be preferable to have a clean normalization of these tags that we can test against.

No immediate action needed here for now, we just wanted to ensure this is not lost in case we need to revisit.