Skip to content

fix: call inline event handlers with the element as this - #137

Merged
markets merged 1 commit into
masterfrom
fix/inline-handler-this
Oct 1, 2026
Merged

markets merged 1 commit into
masterfrom
fix/inline-handler-this

Conversation

@araluce

@araluce araluce commented Oct 1, 2026

Copy link
Copy Markdown
Member

Fixes #136

Events.bind() now calls the original inline handler with the element as this, the same as the browser does. on() is unchanged.

Adds tests/events.test.js, the first tests for Events.

@araluce araluce added bug Something isn't working core labels Oct 1, 2026
@araluce
araluce requested a balanced review from Copilot October 1, 2026 08:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The focused implementation correctly addresses the reported behavior and includes appropriate regression coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes inline event handlers so their this value matches native browser behavior.

Changes:

  • Invokes preserved inline handlers with the originating element as this.
  • Adds tests for handler context and event forwarding.
File Description
src/​events.js Corrects inline handler invocation context.
tests/​events.test.js Tests context binding and event delivery.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@markets
markets merged commit ffe0d99 into master Oct 1, 2026
2 checks passed
@markets
markets deleted the fix/inline-handler-this branch October 1, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inline event handlers lose the element as this

3 participants