*Summary*: Right now there are two ways developers can check if a document is loaded: either query `.readystate`, or use an event listener. The property can be queried but it's not possible to observe changes without the event listener, and the event listener may be registered too late. A better pattern would be to have some kind of value which is either already resolved, or can somehow be observed for when it will resolve. Luckily the platform provides Promises exactly for this!
So I indent to prototype new properties on document: `parsed`, `contentLoaded`, and `loaded`. Each one is a Promise of their equivalent one-shot event, and can be useful for more ergonomically detecting changes. The original spec draft of this - https://github.com/whatwg/html/pull/1936 - was filed in October 2016. I was hoping to send this email a couple of weeks ago to mark the 10th anniversary of the spec PR but other matters got in the way, but here we are! *Bug*: https://bugzilla.mozilla.org/show_bug.cgi?id=2091511 *Specification*: https://github.com/whatwg/html/pull/1936 *Standards Body*: WHATWG *Platform Coverage*: all. *Preference*: `dom.document.load_promises.enabled` *DevTools Bug*: N/A *Extensions Bug*: N/A *Use Counter*: I don't think this is necessary but happy to add one if people think it would be useful. *Standards-Positions Discussion*: N/A *Other Browsers*: - Blink: No signal - WebKit: No signal *web-platform-tests*: Some exist, more will be written during prototyping. -- You received this message because you are subscribed to the Google Groups "[email protected]" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/a/mozilla.org/d/msgid/dev-platform/62e079c2-acca-4007-b13f-5c4bfa0299fa%40app.fastmail.com.
