amphtml
amphtml copied to clipboard
`isDocumentReady` predicate always returns true
In #core/document/ready
, we check if document.readyState
is either loading
or uninitialized
. According to https://developer.mozilla.org/en-US/docs/Web/API/Document/readyState, only the first is possible (TypeScript surfaced this error). uninitialized
isn't even one of the custom ready states (defined in #core/constants/ready-state
) used in custom-element
. As far as I can tell, Document#readyState
is a readonly
property, so unless we're doing something really weird, we should drop the second half of this conditional, which I'm guessing is old dead code.
https://github.com/ampproject/amphtml/blob/main/src/core/document/ready.js#L7
/cc @jridgewell to tell me if I'm missing something.
To respond to the title, the Browser can change the value. We expect the value to be loading
until the full HTML has downloaded, then it'll change to interactive
or complete
when the resources finish. You'll only really notice loading
with really long HTML documents that reference an inline script, and interactive
on docs that have slow-loading images.
uninitialized
isn't even one of the custom ready states (defined in#core/constants/ready-state
) used incustom-element
.
uninitialized
is an old, non-standard IE6 value. I'm not sure which version of IE phased it out, but we should be able to remove now.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.