ampproject / ampproject/amp-toolbox-php

Inline SVG attributes get lowercased

Open
#107 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
74
Forks
25
Avg merge
1d 15h
Merged PRs (30d)
3

Description

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](https://www.w3.org/TR/SVG2/coords.html#ViewBoxAttribute) gets lowercased by the amp-optimizer. Browsers seem to ignore the problem, so this is more a nitpick.

See the `viewBox` attribute here:

Before:
```svg

```

After optimization:
```svg

```

The w3c validator complains about the lowercased `viewbox` attribute when validated as SVG 1.1:
![image](https://user-images.githubusercontent.com/1544760/112027234-49a5d900-8b37-11eb-8ac4-9f6361b1dc98.png)

Contributor guide

No contributing guide indexed for this repository

Research direction

No source file or test is named in the issue. Reproduce the reported inline SVG optimization using the before-and-after example, then locate the optimizer's attribute-name handling and add coverage showing that viewBox is preserved and the optimized SVG passes SVG validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.