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

Events confusion #2771

Closed
NaridaL opened this issue Sep 20, 2016 · 4 comments
Closed

Events confusion #2771

NaridaL opened this issue Sep 20, 2016 · 4 comments

Comments

@NaridaL
Copy link

NaridaL commented Sep 20, 2016

Maybe I'm missing something, but it seems the event handling documentation could be clearer. The documentation for http://mootools.net/core/docs/1.6.0/Element/Element.Event doesn't specify the expected signature of the event handler function (fn in myElement.addEvent(type, fn);)

The assumption that it's the same as the standard addEventListener is wrong, because it gets passed a Mootools Event (whose documentation is broken: http://mootools.net/core/docs/1.6.0/Element/Element.Event links to http://mootools.net/core/docs/1.6.0/Types/Event#Event:stop which 404s).

The Mootools Event isn't compatible with the standard one, for example shiftKey is renamed to shift, although it's not really clear why. cf. https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/shiftKey and https://w3c.github.io/uievents/#dom-keyboardevent-shiftkey

@DimitarChristoff
Copy link
Member

they are normalised events. see http://mootools.net/core/docs/1.6.0/Types/DOMEvent

@SergioCrisostomo
Copy link
Member

SergioCrisostomo commented Sep 20, 2016

@NaridaL as @DimitarChristoff pointed out MooTools creates its own Event object, the purpose is to provide a object with normalized values so you get the same values out of it in all browsers.

You can still access the original event, you can access it in the .event property. The MooTools own event object stores the event the browser issues in that property. There you can find .shiftKey and other event properties not normalized, which means you can have different values in different browsers.

@NaridaL
Copy link
Author

NaridaL commented Sep 22, 2016

@SergioCrisostomo Thanks for the info, I had missed something, as I thought. However it seems the underlying issue of the broken links and the doc not being very informative is still open...?

@SergioCrisostomo
Copy link
Member

@NaridaL good point! Sent a pull request to fix that broken link. Thanks!

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

No branches or pull requests

3 participants