You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Migration to the 2.0 release will require developers depending on etc/ready.js to crib the file into their project source. The code is trivial:
/**
* Await document completeness. Will likely be replaced by built-in apis.
* Check out https://github.com/Netflix/x-element/issues/65 for details.
* @param {Document} target
* @returns {Promise<any>}
*/
const ready = target => {
return new Promise(resolve => {
if (target.readyState === 'complete') {
resolve(target);
} else {
const handle = evt => {
if (evt.target.readyState === 'complete') {
target.removeEventListener('readystatechange', handle);
resolve(target);
}
};
target.addEventListener('readystatechange', handle);
}
});
};
export default ready;
As browsers adopt CSS modules via with { type: css } import attributes, the need to use a DOMReady guard to skirt the Flash of Unstyled Content (FoUC) will finally pass. Instead we will use blocking="render" on imported custom elements. This allows the browser to wait until both JS and CSS content has loaded.
Activity
klebba commentedon Jun 26, 2025
Reminder: we will also remove the package export and a few other places https://github.com/search?q=repo%3ANetflix%2Fx-element%20ready.js&type=code
Remove “ready.js” ahead of “2.x” release.
Remove “ready.js” ahead of “2.x” release.