jQuery pluginify #2

Merged
merged 2 commits into from Apr 2, 2012

Projects

None yet

2 participants

@sirkitree
Contributor

Created the plugin in the root and moved index.html to an /examples folder and modified it to use the plugin.

I ran the code through jslint but some of the suggestion I think were a bit ... off? Anywho, it's mostly compliant. Could probably be cleaned up further, like it should probably create it's own event, but this is a decent start.

@microp11
Owner
microp11 commented Apr 2, 2012

I like your work and here are my thoughts.

When I wrote the code, jQuery was the last thing on my mind. I can see how the original code is linked to jQuery and at the time it did not matter. At this stage, perhaps the code can still be made js pure, with no jQuery dependency?! With the changes you suggest the code would be completely dependent on jQuery, and I'm not saying it is a bad thing, but perhaps there are people out there that may just want the code as is (and make it independent of jQuery).

How about we leave the original as is, and we create another folder for your jQuery plugin?

@microp11
Owner
microp11 commented Apr 2, 2012

Please note, in the original code, the nicks array changes all the time. The source is used to ensure indexes stay the same during search. Unless I'm mistaken, in the plugin's case, the (nicks) is passed as a parameter and won't change during code execution. If this is the case, lines 11, 19-21 and 51 are not needed anymore, and nicks can be changed to source.

@microp11 microp11 merged commit b81f720 into microp11:master Apr 2, 2012
@sirkitree
Contributor

+1 for making this jQuery agnostic as a separate optional script. Perhaps one that could be easily included.

As for the nicks array changing, this is the part where I mentioned that the jQuery plugin should probably provide it's own event, which could then be triggered if the nicks array changes. It would simply be a little more complex use case (though probably quite typical) and we could provide an example on how to do that as well in a separate example.

@microp11
Owner
microp11 commented Apr 2, 2012

Will be travelling for a good part of the week, but looking forward to get to do a bit of coding :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment