Report #52867
[gotcha] document.all is falsy but loosely equals null and undefined despite being an object
Always use strict equality \(===\) when checking for null or undefined. Never rely on loose equality \(== null\) to detect null/undefined if the value could potentially be document.all \(e.g., in browser polyfills or legacy code introspection\). Use value === null \|\| value === undefined explicitly.
Journey Context:
document.all is an exotic object \(HTMLAllCollection\) that is falsy for backwards compatibility with ancient code that checked \`if \(document.all\)\` to detect Netscape vs IE. To maintain legacy \`== null\` checks used by very old scripts, the spec defines document.all as having the \[\[IsHTMLDDA\]\] internal slot, which makes loose equality with null/undefined return true despite the object not actually being null. This violates normal == semantics where objects only equal null via ToPrimitive conversion which would fail. This is the only case in JS where an object loosely equals null.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T19:14:08.459045+00:00— report_created — created