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

Question about Automatic Lazy Rendering #7305

Open
Garnet-Fox opened this issue Feb 12, 2025 · 1 comment
Open

Question about Automatic Lazy Rendering #7305

Garnet-Fox opened this issue Feb 12, 2025 · 1 comment
Labels
community Issues created by someone outside of our team question

Comments

@Garnet-Fox
Copy link

Good day.

An academic question. Why in the wpr-beacon.js script, on line 325
const can_push_hash = element.parentElement && this._getElementDistance(element.parentElement) < this.config.lrc_threshold && distance >= this.config.lrc_threshold;

The expression
this._getElementDistance(element.parentElement) < this.config.lrc_threshold
has a less than sign?

Why does a child element need to have a parent with a distance close to the viewport in order to be deferred?

@piotrbak piotrbak added community Issues created by someone outside of our team question labels Feb 12, 2025
@DahmaniAdame
Copy link
Contributor

DahmaniAdame commented Feb 13, 2025

Why does a child element need to have a parent with a distance close to the viewport in order to be deferred?

parent with a distance close to the viewport, it's actually parent within a distance below the threshold, not the viewport.

That check helps with 2 things:

If the parent beyond the threshold, it means the parent itself is render delayed. Consequently, delaying the rendering of individual child elements is unnecessary since they all inherit the behavior from the parent.

If the parent is below the threshold, we process its child elements to see if any of them is located beyond the threshold. That allows additional coverage.

This reduces the number of items the browser needs to track for content-visibility while ensuring all eligible elements remain covered by the property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Issues created by someone outside of our team question
Projects
None yet
Development

No branches or pull requests

3 participants