-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Clarify then the check whether script is disabled for lazy-load #5250
Comments
A couple of things here:
|
Sorry for confusing. The test I wrote is what I believe that it should be, i.e. the loading=lazy image should be loaded in script disabled documents even if the image has already been in the state of 'will-lazy-load-image-steps'. |
Ahh I see. The spec doesn't explicitly check for script-enabled-ness after the will-lazy-load-image steps are run, and since Chrome passes the test, it feels like Chrome is somehow checking whether scripting is enabled after those steps are run. However, I believe when an image is adopted into another frame, the updating-the-image-data steps are re-run (i.e., the will-lazy-load-image steps are run again). That is an interesting scenario. Since it is a non-normative section in the spec, it is not explicitly mentioned how/when exactly a browser should perform this check in relation to the image loading algorithm steps. With that said, I'm not sure if this issue is actionable or if we can write tests for it. |
Uhm, should is not non-normative. See also https://infra.spec.whatwg.org/#conformance. A "should" is a requirement that you can chose not to follow if you have a very good reason for not following that requirement. It's still a normative requirement and can be tested. And if everyone plans to implement it perhaps we ought to make it a "must" instead. |
I see. Sorry for my misunderstanding; @hiikezoe's test would be good to add then. Feel free to submit a WPT PR. I am happy making it a "must" if everyone plans to implement it. @annevk do you think adding a condition to "will lazy load image steps" that checks whether scripting is enabled makes sense? I think this will suffice, because after a deferred image is removed and inserted into another document, my understanding is that the #updating-the-image-data steps are re-run. |
So it would still not delay the load event? |
Correct. This should be OK from a tracking perspective, but on the other hand I like the consistency of scripting-disabled == all lazy load behavior turned off (all fetches are eager, all images delay the load event). |
BTW @hiikezoe would you be willing to make a WPT PR for your test? Since we're making it very explicit in the spec that scripting must be enabled for the |
@domfarolino I've already included two web platform tests for that in our lazy-load implementation bug. Those will be merged into upstream once after it landed in our tree. |
Note for future reference: the relevant "Lazy loading attributes" spec currently lives here, still with the note about disabling lazy when scripting is disabled:
|
Though the spec says user agents should not honor the lazy loading attribute when scripting is disabled, but as far as I can see there is no description when it's done.
I have an interesting edge case, that is that an image element which is in the state waiting for load due to 'lazy" is moved into an iframe that script is disabled there. I was guessing the image in question is not loaded on Chrome because, as per the spec text, there seems no chance to check it after the image became the state of 'will-lazy-load-image-steps', but actually Chrome does.
@domfarolino, @annevk, @emilio
The text was updated successfully, but these errors were encountered: