Skip to content

import events from html5 menus #205

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

Closed
wants to merge 3 commits into from
Closed

import events from html5 menus #205

wants to merge 3 commits into from

Conversation

jzelenkov
Copy link
Contributor

takes everything what @jbinary has done in #137 and adds improvements mentioned by @rodneyrehm

@jzelenkov
Copy link
Contributor Author

just realized that my text editor removed all trailing spaces. Should I reintroduce them back?

@rodneyrehm dom event types are listed in array. String was way too long. Multiline string generated new empty string array elements for each identation. And having string concatenation looked even worse.

@jzelenkov
Copy link
Contributor Author

@rodneyrehm
Copy link
Contributor

Nice! I think I wouldn't go with a static list of events, but rather do something along the lines of

var eventNames = Object.keys(node)
  .filter(function(propertyName){ return propertyName.slice(0, 2) === 'on'; })
  .map(function(propertyName){ return propertyName.slice(2) });

(yes, I'd roll the filtering, mapping and event-registration into one loop, this is for illustration only. Same goes for Object.keys())

@jzelenkov
Copy link
Contributor Author

@rodneyrehm Cool! I like your suggestion! Just a sec

@jzelenkov
Copy link
Contributor Author

@rodneyrehm according to W3C spec all html elements must support these event types. I think it would make more sense to do something like this:

defaults = {
   ...
   domEventTypes: getSupportedDomEventTypes()
}

and reuse that array within get_events() rather than recreating it every time. getSupportedDomEventTypes would contain your suggested code

@jzelenkov
Copy link
Contributor Author

@rodneyrehm event types differ a lot between browsers: chrome, firefox, ie9. Shall we keep it the same way or use a list events from W3C?

@rodneyrehm
Copy link
Contributor

I'd only bind the events a browser understands… so I'd stick with detection rather than static list.

@jzelenkov
Copy link
Contributor Author

OK. Let me know if you think anything else should be changed

@jzelenkov
Copy link
Contributor Author

@rodneyrehm What needs to be done for this PR to be accepted?

@rodneyrehm
Copy link
Contributor

time to merge and test the stuff

@jzelenkov
Copy link
Contributor Author

OK

@rodneyrehm
Copy link
Contributor

My time is extremely short. If you're interested in taking over the lead of this plugin for a while, we can talk about giving you the necessary privileges - contact me at mail at rodneyrehm dot de if you're interested

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

Successfully merging this pull request may close these issues.

2 participants