Skip to content

Support DOM event listeners and bubbling - #40

Merged
cowboyd merged 1 commit into
wpt-attributesfrom
dom-mutation-and-events
Nov 12, 2026
Merged

cowboyd merged 1 commit into
wpt-attributesfrom
dom-mutation-and-events

Conversation

@cowboyd

@cowboyd cowboyd commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Give DOM nodes native event listener registration/removal and dispatch events through their ancestor chain when bubbles is true.

This re-uses Node's native EventTarget and Event classes which do not support the capture phase

Type of change

  • Bug fix
  • Feature
  • Refactor (no behavior change)
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • All tests pass (pnpm test)
  • Files are formatted (pnpm format)
  • I have added/updated tests for my changes (if applicable)
  • I have added a changeset

AI-generated code disclosure

  • This PR includes AI-generated code

@pkg-pr-new

pkg-pr-new Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/bombshell-dev/ui/@clack/ui@40

commit: 61314e9

@cowboyd
cowboyd added this pull request to stack #42 October 21, 2026 04:36
@cowboyd
cowboyd force-pushed the dom-mutation-and-events branch from 2cc8bab to 70ceefd Compare October 21, 2026 05:08
Comment thread packages/ui/src/dom.ts Resolved
Comment thread packages/ui/src/dom.ts Resolved
Comment thread packages/ui/src/dom.ts Resolved
@cowboyd
cowboyd requested a review from 43081j October 22, 2026 18:29
@cowboyd
cowboyd force-pushed the dom-mutation-and-events branch 6 times, most recently from c52ab19 to 4ce76a9 Compare November 2, 2026 16:45
Comment thread packages/ui/src/dom.ts Resolved
Comment thread packages/ui/src/dom.ts Resolved
Comment thread packages/ui/src/dom.ts

// Node exposes these constants at runtime, but its type declarations omit them.
export const Event = globalThis.Event as typeof globalThis.Event & {
readonly NONE: 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given its about as much code to re-declare these as it is to just have our own constants, what do you think about having our own constants?

i.e. const EVENT_NONE = 0 etc

otherwise i would try solve this through augmentation rather than casting. augment the global interface/class with the extra members etc

@cowboyd
cowboyd force-pushed the dom-mutation-and-events branch 2 times, most recently from 25c3313 to 2f7b33a Compare November 12, 2026 18:38
@cowboyd
cowboyd marked this pull request as draft November 12, 2026 18:39
@cowboyd cowboyd changed the title ✨ ui: add DOM mutations and events Support DOM event listeners and bubbling Nov 12, 2026
@cowboyd
cowboyd removed this pull request from stack #42 November 12, 2026 18:40
@cowboyd
cowboyd changed the base branch from main to wpt-attributes November 12, 2026 18:40
@cowboyd
cowboyd added this pull request to stack #63 November 12, 2026 18:40
@cowboyd
cowboyd marked this pull request as ready for review November 12, 2026 18:47
@cowboyd cowboyd mentioned this pull request Nov 12, 2026
6 of 12 tasks
@cowboyd
cowboyd force-pushed the dom-mutation-and-events branch 2 times, most recently from eeca628 to 485fda4 Compare November 12, 2026 21:17
@cowboyd
cowboyd force-pushed the dom-mutation-and-events branch from 485fda4 to 61314e9 Compare November 12, 2026 21:54
@cowboyd
cowboyd merged commit 83e840c into main Nov 12, 2026
8 of 10 checks passed
@cowboyd
cowboyd deleted the dom-mutation-and-events branch November 12, 2026 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants