-
Notifications
You must be signed in to change notification settings - Fork 85
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
Turn off events. #8
base: master
Are you sure you want to change the base?
Conversation
@@ -1,51 +1,87 @@ | |||
/*globals Element:true, NodeList:true*/ | |||
$ = (function (document, $) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you restore the 2 white space - otherwise I see a 100% file change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@remy FYI you can also view any commit without whitespace differences by appending ?w=1
to the URL. E.g. https://github.com/remy/min.js/pull/8/files?w=1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I've been doing that - but integrating the change also means reversing out the white space changes - fun times :)
Happy to merge this after my code review notes have been actioned. I hope you don't see this as my being a pain - I'm trying to start giving decent feedback on pull requests that can help developers. In the past, I'll pulled the changes in, then made the fixes myself, which doesn't help the person who contributed the change, since they don't learn what changes we needed to land in the project. I do appreciate the contribution :) |
@remy Not an issue at all! I have made the changes and pushed, please have a look and let me know if that is fine. |
Let me know when you're done with the changes. I can see some of them have come through, but the diff still shows 100% change due to spaces converted to tabs (I should really add a .jshint file to help with this), but also a few other bits - so I don't want to assume this is done whilst you're still working. Equally, if you're done, I can point you to a few issues outstanding :) |
I think I'm done. |
Hmm. Actually reviewing the code closer, there's a bigger issue. Basically the handler array should be specific to each element, because as it the array grows, in your off method, it's looping over everything. I've written my own event handler code that also has an off method (in xui.js), so I'll see if I can merge these two together. |
@remy Oh ok! I was under the notation that |
Hmm, actually you're right - I might have misread the change. I think I need to pull it in, write some tests and see how it goes :) On 25 May 2013 13:11, hemanth.hm [email protected] wrote:
|
Okies :) Tried :
And also was playing around here I still feel that we need that |
Yeah, you missed my point about removing
|
I've got this all working on a branch now, but I'm now looking at why I original, intentionally left out an Not sure how anal I should be about a foot print less than 1K though... |
Oh ok! Even I was wondering why Binding |
I still have merged this pull request only because I wonder if it's worth trying to preserve the simplicity of the library - and not have an Then on the other hand, what does it matter if one more method is added? I'd like to put this to a public vote. If there's a "decent" number of people who want this functionality, I'll add it in. By decent, I guess I mean 5 or so +1s (-1 obvious counts against). Sound reasonable? |
@remy Yup, this seems to be the best way to decide conflicts like this 👍 :) |
How about giving yourself a performance budget, so every time you add something you improve or take something out. Decide a maximum file size. Not tried running the code, but nodelist and element seem to have identical methods assigned to them. Is it possible to do:
You could reduce the file size a bit then though the code would be harder to read. But if a goal of the project is to have an extremely small file size then it would be justified. /t |
@maslen that's a nice idea for space saving, but not sure it works with this source code, since the Also it's more the logical size, of the api, rather than the file size. 500bytes compared 1k is no real difference unless it's 100% experiment, so I'm not hellbent on keeping the file size über small. |
@zigotica what do you mean by delegated? You can do it with regular code: http://jsbin.com/awikaz/1/edit |
yep, i ment sugar for that :) |
grosso! On Friday, June 28, 2013, Remy Sharp wrote:
Sergi zigotica.com |
👍 from me! |
And one more 👍 |
It's because I prefer simplicity, and I feel like the library in it's I'm not saying this change makes it hard and complex but I'm just
|
👍 |
Why not move events into a separate "observer" library and keep min.js focused on DOM querying / manipulation? |
+1 to @jslegers's suggestion |
👎 to increasing file size this way Another way is to have functions only respond to states reflected on the element: <button disabled></button> .on( '[disabled]', triggerQueueForDisabled) 👍 for adding something like denodify and coldcall instead yours, |
👍 it's very common to disable events if you maintain a plugin and implement some kind of |
👍 to support for removing event handlers |
👍 |
👍 |
maybe the on/ off/ one should be a plugin.... :-) |
Similarity with nodeList.