-
Notifications
You must be signed in to change notification settings - Fork 16
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
Can LargestContentfulPaint's element attribute be null? #16
Comments
If the Element is disconnected then 'element' attribute getter should return null. Note that the 'element' attribute getter is NOT defined to just be the 'value it was initialized to'. |
Thanks, that explains why it could return null. Still, why is it like this? One still has to hold old to the element internally and the getter can start returning it again later. Is exposing "is it connected to the same document as before" the direct purpose, or is some optimization made possible this way? |
The reason is to not hold on to the element forever. The LargestContentfulPaint entry could live after the Element is removed from the DOM tree, so the idea is that we keep exposing some properties of it but the user agent will be allowed to garbage-collect the Element (we should not block garbage collection of Elements on these entries). |
I see, not keeping the Element alive was the motivation. I've filed #29 and a similar issue on Element Timing since it looks like the spec doesn't quite achieve this, but it's complex so I'm not entirely sure. |
Closing this since it has been answered and there's a more specific issue filed. |
https://wicg.github.io/largest-contentful-paint/#sec-largest-contentful-paint-interface says:
However, https://wicg.github.io/largest-contentful-paint/#sec-processing-model is the only place that creates instances of
LargestContentfulPaint
, and there element cannot be null.If it can't be null the
?
can be removed from the Web IDL and readers need not wonder :)The text was updated successfully, but these errors were encountered: