jquery / jquery/jquery-simulate

The event object is not passed to the handler

Open
#22 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
172
Forks
109
PR merge metrics
No merged PRs in 30d

Description

Regression after https://github.com/jquery/jquery-simulate/commit/206bbf873e8f63646fcd1daa3c4713c2ebd66196. In this commit, the following code was added:

if ( elem[ type ] ) {
    elem[ type ]();
} else …

But in this code, the event object is not passed to the handler! It leads to lots of bugs, for example, inability to use options for the click event:

$('button').simulate('click', { button: 2 }); /* right mouse button */

It has bad influence on the focus (and hence focusin and focusout) event as well.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the event-dispatch code introduced in commit 206bbf873e8f63646fcd1daa3c4713c2ebd66196, especially the elemtype branch. Trace the click and focus paths and verify that the supplied event object reaches their handlers, including the button option for click. Done means handlers receive the event object without regressing focusin or focusout behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.