refactor Document, element, and related files#287
Open
jderochervlk wants to merge 12 commits into
Open
Conversation
jderochervlk
marked this pull request as draft
July 8, 2026 19:29
jderochervlk
force-pushed
the
refactor-document
branch
from
July 8, 2026 19:36
5ff56df to
84d24ac
Compare
jderochervlk
marked this pull request as ready for review
July 8, 2026 21:26
This was referenced Jul 9, 2026
brnrdog
reviewed
Jul 11, 2026
brnrdog
left a comment
Collaborator
There was a problem hiding this comment.
I liked the types living within their interfaces, makes them much more discoverable than before with the DOMTypes. I think the DOMTree is fair given the recursive types.
I'm just missing a .t for Element/Node/HTMLElement, like we do for other modules. What if we add a small alias on each like:
type t = DOMTree.element
include Impl({type t = t})
Collaborator
Author
Yeah, I think having a type |
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.
This one is larger than the previous PRs, but it builds on the same ideas.
I don't love
DOMTree, but I needed a spot to store types that are used across other modules without increasing the size ofDOM. If I can getDOMdown more I might remove this later.Main changes:
DOMTree,HTML, andSVGElement.DOM/DomTypesstyle into more specific modules:DOMTree.node,DOMTree.element, etc.HTMLImageElement.t,HTMLVideoElement.t,HTMLCanvasElement.t.SVGElement.svgImageElement.DOM, likeDOM.domRectReadOnly,DOM.canvasRenderingContext2D,DOM.videoFrame,DOM.fileList.src/Base/DOM.resby extracting large chunks of element/node/document-related structure into dedicated files.DomTypes.*Typesdefinitions directly into their owning modules, notablyMutationObserver, and deletesMutationObserverTypes.res.Element.tinstead ofDomTypes.element.