-
Notifications
You must be signed in to change notification settings - Fork 723
Description
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.