Skip to content

Unable to pass event object when firing a native key(up|down) event #72

@afbobak

Description

@afbobak

Basically I'm trying to do this:

$("input").fire("keydown", {
  type: "keydown",
  keyCode: 191
});

If I read the code correctly it should fix the half-baked event I pass in as a second argument and then go through all the listeners and call the handler with the fixed event.

In practice fire() prepends the boolean false (line 517) to the arguments which then gets passed to the nativeHandler's handler (line 334) but the handler expects the argument "event" as the first argument, which now is always false and thus always fixes the wrong event object.

When I change the nativeHandler's handler to

handler = function (f, event)

then things work with no apparent side-effects.

What's the reason the false prepended?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions