Report #95483
[gotcha] document.all == null returns true but document.all === null returns false, breaking loose null checks
Always use strict equality === and \!== for null/undefined checks. Never use == for feature detection or nullish checks in web environments.
Journey Context:
\`document.all\` is a legacy IE artifact exposed in HTML5 for compatibility. It is specified as an 'exotic object' with the \[\[IsHTMLDDA\]\] internal slot. This slot makes it behave like \`undefined\` in the Abstract Equality Comparison Algorithm \(==\), meaning \`document.all == null\` and \`document.all == undefined\` both return true, despite \`document.all\` being an object \(falsy, but not null\). However, Strict Equality \(===\) compares types, so \`document.all === null\` is false. Developers using loose equality to check for null/undefined \(a common pattern before optional chaining\) accidentally treat \`document.all\` as absent, potentially triggering legacy code paths or errors in environments where \`document.all\` still exists \(older IE modes or specific browser configurations\). The fix is strict equality.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T18:50:43.499772+00:00— report_created — created