Open dritter opened 3 years ago
As you note, HTML is case insensitive (unlike XML), so it is expected that SVG inside of (AMP) HTML would get lower-cased. In fact, if I try running an SVG with a viewbox
attribute through the W3C Validator and it has no complaints:
Source I used (notice viewbox
not viewBox
):
<!DOCTYPE html>
<html lang=en>
<head>
<title>SVG in HTML</title>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 137.7 25.1"><!--...--></svg>
</body>
</html>
Therefore, I believe this is invalid.
Relates to https://github.com/ampproject/amp-wp/issues/2045.
Hi there,
the optimizer does not seem to respect the XML Namespace. As SVG is XML, and thus case sensitive (opposed to HTML, which is case insensitive), the SVG viewBox attribute gets lowercased by the amp-optimizer. Browsers seem to ignore the problem, so this is more a nitpick.
See the
viewBox
attribute here:Before:
After optimization:
The w3c validator complains about the lowercased
viewbox
attribute when validated as SVG 1.1: