Skip to content

Prototype.js error: Uncaught TypeError: eventName.include is not a function #463

@dgunwin

Description

@dgunwin

I experienced a bug when using the Keyboard plugin alongside Prototype.js. I thought I would put my solution here, in case anyone else has the same problem in the future.

Prototype was giving the following error:
"Uncaught TypeError: eventName.include is not a function"

I tracked the error down to following line of code inside the 'base.close' method of the Keyboard plugin:
.trigger((o.alwaysOpen) ? '' : kbevents.kbBeforeClose, [base, base.el, (accepted || false)])

The reason Prototype was throwing the error was because of the empty string event (the error only happens when alwaysOpen is set to true).

To fix the error I just added another event called 'nullEvent' to the $keyboard.events object.

Then I modified your line of code like this:
.trigger((o.alwaysOpen) ? kbevents.nullEvent : kbevents.kbBeforeClose, [base, base.el, (accepted || false)])

There might be a better solution, but this seemed to work for me. The main point is the Prototype does not like the event being an empty string.

Hope it helps someone in the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions