4 ms·
I wish browser vendors, instead of native lazy loading for images, focused on a universal mechanism to lazily render arbitrary elements, including custom ones.
by goblin89 7y ago
I wish browser vendors, instead of native lazy loading for images, focused on a universal mechanism to lazily render arbitrary elements, including custom ones.
Browsers could profile how long rendering a particular type of element takes on a given website, and optimize render triggers to provide seamless experience while conserving bandwidth.
Currently lazily rendering custom elements requires a fair chunk of IntersectionObserver boilerplate code, and beyond that any adaptability to user connection seems too complex to even consider.
- andy_ppp 7y agoI think you are conflating React elements (a blob of JS) and HTML elements (er the DOM?) in the comment to the point where I find it very difficult to reason about what an answer would look like. If you replace your use of element with "blob of javascript" how would the browser separate out the "element" blobs that are "slow" from the other Javascript?
- goblin89 7y agoI mean purely custom elements, no React at all (which should not be of concern to browser vendors anyway). The metrics that would matter are similar to what we see in browser developer’s tools profilers—ones that measure the approximate time from when script execution starts until the document is rendered, or others depending on how custom element is bundled. This is with a degree of imprecision overall, of course, but similar approaches I imagine could be used to profile individual element rendering times. Edit: Tried to clarify my idea, being away from any browser developer tools at the moment myself.