Move the event objects to their own module - #88
Closed
brainkim wants to merge 1 commit into
Closed
Conversation
The Event classes, DataTransfer, EventTarget with its listener store, the event handler attributes, and the helpers that go with them leave dom.ts. events.ts imports nothing from dom.ts at runtime: it finds a target's document through the public node and window shape, reports errors through the window's own reportError, and leaves dispatchEvent to dom.ts, which installs it on the prototype beside the dispatch algorithm it belongs to. The get-the-parent protocol becomes one function in dom.ts over the tree types instead of a symbol-keyed method four classes overrode. dom.ts imports 57 names back, and the drift check reads the event classes from the new module. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Bw3yEu4cfkuDkaZ3RSy4D
Member
Author
|
@claude You have 3 fucking instructions in the CLAUDE.md. Jeez |
|
I'll analyze this and get back to you. |
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.

Stacked on #87.
src/internal/events.ts(2977 lines out of dom.ts). The Event classes and their init dictionaries, DataTransfer and FileList, EventTarget with its listener store, the event handler attributes, and the integer conversions, construction guard and hover-listener counting they use.It is a leaf. events.ts has a type-only import from dom.ts and nothing at runtime, so there is no evaluation-order hazard for
Node extends EventTarget. Three things made that possible:reportErrorgoes through the window's ownreportError, which dom.ts implements with a trusted dispatch.dispatchEventis declared on the class and installed on the prototype by dom.ts, next to the dispatch algorithm, which stays in dom.ts because building the path needs retargeting, slots and activation behavior.No symbol crosses. The get-the-parent protocol, a symbol-keyed method four tree classes overrode, is one function in dom.ts over the tree types. dom.ts reads dispatch state and listener lists through
getDispatchStateandgetListeners. The 26 prototype installs for the event classes moved with them.dom.ts goes from 31,416 to 28,522 lines. The lib.dom drift check reads the event classes from the new module.
Typecheck, lint, suite 1619/1619 on node and bun, 37/37 examples, lib.dom drift 148 exact.
🤖 Generated with Claude Code
https://claude.ai/code/session_015Bw3yEu4cfkuDkaZ3RSy4D