🔎 Search Terms
I think document.scrollingElement should be of type Document["documentElement"] | null instead of Element | null. The spec (e.g. this and this) says that in standards mode scrollingElement returns the document root, which is document.documentElement and in quirks mode returns document.body or null.
document.body is always HTMLElement (right?) In principle, document.documentElement does not have to be HTMLElement (and there's an open issue about this, #29052, but currently Document.documentElement is still defined as HTMLElement, for some reason. So how come document.scrollingElement is not HTMLElement | null?
🕗 Version & Regression Information
N/A
⏯ Playground Link
No response
💻 Code
🙁 Actual behavior
document.scrollingElement is of type Element | null whereas document.documentElement and document.body are both of type HTMLElement.
🙂 Expected behavior
The non-null part of document.scrollingElement should be the same type as document.documentElement, which technically should be Element, but if document.documentElement is left as HTMLElement, as is currently, then document.scrollingElement should also be this.
Additional information about the issue
No response
🔎 Search Terms
I think
document.scrollingElementshould be of typeDocument["documentElement"] | nullinstead ofElement | null. The spec (e.g. this and this) says that in standards modescrollingElementreturns the document root, which isdocument.documentElementand in quirks mode returnsdocument.bodyornull.document.bodyis alwaysHTMLElement(right?) In principle,document.documentElementdoes not have to beHTMLElement(and there's an open issue about this, #29052, but currentlyDocument.documentElementis still defined asHTMLElement, for some reason. So how comedocument.scrollingElementis notHTMLElement | null?🕗 Version & Regression Information
N/A
⏯ Playground Link
No response
💻 Code
// Your code here🙁 Actual behavior
document.scrollingElementis of typeElement | nullwhereasdocument.documentElementanddocument.bodyare both of typeHTMLElement.🙂 Expected behavior
The non-null part of
document.scrollingElementshould be the same type asdocument.documentElement, which technically should beElement, but ifdocument.documentElementis left asHTMLElement, as is currently, thendocument.scrollingElementshould also be this.Additional information about the issue
No response