DOM mutation, MutationObserver, Range and node documents differ from the DOM spec
Author: ice-zeusCreated Oct 1, 2026Updated Oct 1, 2026
DOM mutation, MutationObserver, Range, node document and some CSSOM behavior differs from the DOM and CSSOM specs and from Chromium. A 22-file WPT subset passes 69 of 169 subtests on main (Chromium: 165), and one harness never completes.
Environment: 2f6e09a, release --features render,stealth, WPT 8b6e09b0fe80243092050c92ff430a47c2d30b77, x86_64 Linux.
Main causes, by area:
- Insertion and removal.
insertBefore(null, null)returns silently.- Non-Node arguments to
removeChildthrowNotFoundErrorinstead ofTypeError. - Document child constraints (one element, one doctype, doctype before element, no text) are not enforced.
- The order of the pre-insertion checks differs from the spec, so the wrong exception is thrown.
- MutationObserver records.
- Records have no
previousSibling,nextSiblingorattributeNamespace. - Inserting a DocumentFragment produces one record per child.
- Moving a node produces no removal record on its old parent.
removeAttributeproduces no record.- Options are not validated.
- Records have no
- Range.
deleteContents,extractContents,cloneContentsandsurroundContentsare no-ops. Observers waiting on their records never fire, which is the cause of theMutationObserver-childList.htmltimeout. - Node documents.
Node.ownerDocumentalways returns the main document.createHTMLDocumentandcreateDocumentreturn plain objects rather thanDocumentnodes. - CSSOM.
@mediarules are opaqueCSSRuleobjects, somediaRule.insertRuleis not a function. CSSOM rule changes do not invalidate cached computed style. - getComputedStyle. It returns real values for detached elements; Chromium returns an empty declaration.
- IntersectionObserver.
- The callback's
thisis not the observer. - Entries are plain objects.
isIntersectingignores thresholds.boundingClientRect.leftis 15 or 19 instead of 11 in two tests. The cause is in layout: inside aninline-block, block children share a flex row (auto widths collapse to 0), and formatting whitespace around them takes space.
- The callback's
Minimal checks:
document.body.insertBefore(null, null); // returns; Chromium throws TypeError
document.implementation.createHTMLDocument("t")
.createElement("p").ownerDocument === document; // true; should be the new document
document.createRange().deleteContents; // runs, removes nothing
getComputedStyle(document.createElement("div")).display; // "block"; Chromium ""A pull request with the fixes and tests follows.
Source: h4ckf0r0day/obscura