Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

“Effective size” error handling #127

Closed
eeeps opened this issue Mar 13, 2014 · 3 comments
Closed

“Effective size” error handling #127

eeeps opened this issue Mar 13, 2014 · 3 comments

Comments

@eeeps
Copy link

eeeps commented Mar 13, 2014

Right now if we can’t determine an ‘effective size’ we return 300px.

(Presumably, if #86 sees implementation, there will be an effective box size of 300 × 150 — the default size for replaced elements).

Could we instead wait for layout, figure out what the rendered size of a source with infinite pixel dimensions would be, and use that as an effective size?

This seems like it would produce the expected results in cases where authors use media queries which the browser can't parse, improving backwards compatibility for e.g. the new media query syntax.

It also complicates implementation and might hide authoring errors.

One additional benefit: authors could leave off the sizes attribute intentionally in cases where they don’t care about preloading, e.g. for postponed images.

@zcorpan
Copy link

zcorpan commented Mar 19, 2014

We can't wait for layout, that's incompatible with the goal of enabling early load of images. We want to be able to load images in the pre-scanner even.

That said, I'm not sure I like the 300px default. If the sizes attribute is absent we could let the effective size be "error" and drop candidates with missing density descriptors on the floor. It's an authoring error to do <img srcset="foo.jpg 500w"> without sizes, and it's less noticeable for the author that something is wrong if it magically does something instead of falling back to src.

@eeeps
Copy link
Author

eeeps commented Mar 19, 2014

If/when there's a way to explicitly mark up an image as something you want loaded later (lazy loading), it would be nice to be able to mark it up in a layout-agnostic way. But yeah, error-handling that would also apply to images that hadn't been marked as lazy-loaded probably isn't the way to do it.

Falling back to src rather than picking a size based on 300px makes sense to me, though I bet in many cases they'd have the same result (picking the smallest source).

@zcorpan
Copy link

zcorpan commented Mar 28, 2014

Thinking about it some more, we could change the default to 100% instead of 300px. That seems like a useful default.

@zcorpan zcorpan closed this as completed in cd2c581 Apr 8, 2014
yoavweiss added a commit that referenced this issue Apr 8, 2014
Change the fallback value of sizes from 300px to 100%. Fixes #127
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants