Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
dgunwin opened this issue May 23, 2016 · 3 comments
Closed
Labels

Comments

@dgunwin
Copy link

dgunwin commented May 23, 2016

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.

@Mottie
Copy link
Owner

Mottie commented May 23, 2016

Hi @dgunwin!

Thanks for reporting this issue. I'll have a fix applied to the master branch here shortly. If you are using a package system, it won't be available until the next release.

@Mottie
Copy link
Owner

Mottie commented May 23, 2016

Wow, GitHub is experiencing some update delays. I think I'll go ahead and push the next release. Hopefully GitHub will catch up.

@Mottie Mottie added the Bug label May 23, 2016
@Mottie Mottie closed this as completed in a8492ca May 23, 2016
@dgunwin
Copy link
Author

dgunwin commented May 24, 2016

Thanks a lot for your quick response Mottie, and for the update.

And thanks a lot for your Keyboard plugin - it's really good, and saved me a lot of time. Really appreciate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants