Fix DOM parity gaps found via real-world MDN test scenarios - #49
Merged
Conversation
document.location was never set, so scripts using the common document.location.href pattern threw silently inside sandboxed event handlers. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Only onclick/onload/onerror were connected to the handler-property mechanism; assigning el.onchange etc. silently did nothing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Only insertAdjacentHTML existed; these two ChildNode-mixin methods are common in real-world scripts that insert an existing element or plain text next to a reference node. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Covers URL-param personalization, localStorage-backed preferences, insertAdjacentElement-based list growth, matchMedia, and getBoundingClientRect + CSS custom properties. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughChangesDOM binding extensions
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant JavaScript
participant ElementBindings
participant DOMTree
participant MutationObservers
JavaScript->>ElementBindings: call insertAdjacentElement or insertAdjacentText
ElementBindings->>DOMTree: insert node at computed position
ElementBindings->>MutationObservers: notifyChildList with sibling context
ElementBindings-->>JavaScript: return inserted element or undefined
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
🎉 This PR is included in version 2.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mdn/dom-examples(URL params, localStorage, insertAdjacent, matchMedia, getBoundingClientRect) and found 3 genuine jsdom-parity gapsdocument.locationwas never set (onlywindow.locationexisted), so scripts using the commondocument.location.hrefpattern threw silently inside sandboxed event handlersonchange/oninput/onsubmit/onresethandler properties were never wired to the event system (onlyonclick/onload/onerrorwere)insertAdjacentElement()/insertAdjacentText()were missing (onlyinsertAdjacentHTML()existed)RealWorld.harness.tsTest plan
tsc --noEmitclean inexample/clang++ -fsyntax-onlyclean on all three touched C++ filesyarn --cwd example test:harness:ios/test:harness:androidon a real device/simulator🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
insertAdjacentElement()andinsertAdjacentText()for inserting elements and text at standard positions.onchange,oninput,onsubmit, andonreset.document.location, including URL reading and navigation assignment support.Tests