demo · v132
Error matrix — the seven inactive scenarios
A popover or dialog can end up in an “inactive” document seven different ways — including detached iframe, navigated-away document, adopted node, removed shadow host. v132 ensures every one of them throws InvalidStateError on showModal() / showPopover(). Click each row to fire the scenario; observe the verdict and the actual exception thrown.
| scenario | pre-132 | v132+ verdict | real result here |
|---|---|---|---|
| dialog created in iframe, iframe detached | silent no-op | throws | — |
| popover created in iframe, iframe detached | silent no-op | throws | — |
| dialog adopted into iframe doc, then iframe detached | silent no-op | throws | — |
| popover in a Document parseFromString-detached doc | silent no-op | throws | — |
| dialog in active document (control) | shows | shows | — |
| popover in active document (control) | shows | shows | — |
| dialog reattached after detachment | shows | shows | — |
// pre-132: silent no-op; the dialog never appears, no exception.
// v132+: throws DOMException InvalidStateError with message "Document is detached".
try { dlg.showModal(); } catch (e) { ... }