Respec: width=150 is added to images

Created on 2 Apr 2021  路  7Comments  路  Source: w3c/respec

The image at https://saschanaz.github.io/media-source/#introduction gets width=150 height=150 while ReSpec itself does not add them.

https://github.com/saschanaz/media-source/blob/703174b6ec24d457eb348657f5b9db9d44f21320/media-source-respec.html#L145 is the source, why is this happening? 馃

bug

All 7 comments

ReSpec does add it, but not in Firefox. See https://github.com/whatwg/html/issues/3510#issuecomment-369982529
ReSpec should probably make an exception for img[src$=".svg"] (not perfect, but works for most use cases).

(_Cues Spider-Man music_; ~browser bug, browser bug~ webcompat, webcompat, does whatever a browser can)

Oh, maybe this should be transferred to ReSpec? I think this is a regression since the current spec doesn't have that issue.

BTW, the SVG image does have intrinsic size which is 1500x1500, not sure why Gecko reports 0 and Blink reports 150 馃

Okay: https://bugzilla.mozilla.org/show_bug.cgi?id=1607081
Oh actually not, it seems viewBox has nothing to do with actual width and height? 馃

Code related to naturalWidth hasn't changed since the current spec was generated. Probably Chrome/Puppeteer behavior changed.. Or this has existed before but incorrect height/width were manually removed before deploy.
ReSpec should either skip .svg files, or authors should add an appropriate height/width.

Adding width to SVG easily exceeds the page width because there is no max-width. I guess we want to set max-width to every image in the page, what do you think?

I think we should maybe remove the image sizing code from ReSpec... it's trying to be clever where it probably shouldn't be.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marcoscaceres picture marcoscaceres  路  4Comments

saschanaz picture saschanaz  路  5Comments

marcoscaceres picture marcoscaceres  路  5Comments

marcoscaceres picture marcoscaceres  路  6Comments

andrea-perego picture andrea-perego  路  3Comments