sitespeedio / coach

Clear Eyes. Full Hearts. Can’t Lose.
MIT License
1.21k stars 64 forks source link

avoidScalingImages should ignore svg that doesn't have any width #295

Open DannyvanHolten opened 6 years ago

DannyvanHolten commented 6 years ago

As we use svg images on our website they autoscale to the width of the browser. They are size independent. But sitespeed sees them as scaled images. It should ignore those svg's in the score.

tobli commented 6 years ago

Hi @DannyvanHolten! Could you please provide a url for a site where you see this, as well as the version of sitespeed.io/coach you're using. I tried this on a few sites, but couldn't replicate.

Thanks, /Tobias

mfontani commented 3 years ago

We're being bit by this on our main site, but have provided a separate easier to test page which exhibits this issue.

See https://www.theregister.com/Design/page/sitespeedio_bug.html

In it, there are five test cases:

  1. what we use on the main site - a SVG + PNG sized 340x63 and put in a 190x35 img (errors)
  2. shouldn't error but does! - a SVG + PNG sized 190x35 and put in a 190x35 img (errors, but most definitely shouldn't!)
  3. shouldn't error but does! - a SVG sized 190x35 and put in a 190x35 img (errors, but most definitely shouldn't)
  4. doesn't error, yay! - a PNG sized 190x35 and put in a 190x35 img (passes)
  5. errors - a PNG sized 340x63 and put in a 190x35 img (errors)

Unsure if this may help understanding what might be going wrong here.

I do wonder, though, whether the avoidScalingImages error makes any sense for SVGs.