10 ms·
Geez. What's up with the "write 20 lines of trivial javascript, put it on github, put more effort into making a webpage than the actual code, post it on HN".
by nixarn 15y ago
Geez. What's up with the "write 20 lines of trivial javascript, put it on github, put more effort into making a webpage than the actual code, post it on HN".
- weixiyen 15y agoI don't mind that it's trivial if it saves me from doing some tedious stuff, but after reading the code it's unusable the way it's written right now. Some of the things that need to change are: 1) DOM selectors must be defined by user, not the plugin itself. 2) Needs to actually work on more than just Webkit based browsers. 3) Don't use $(document).ready() in the plugin, find another way or design the API differently.
- robert-boehnke 15y agoCan you elaborate why $(document).ready() should not be used?
- weixiyen 15y agoIt's a matter of best practices. In particular how it's done in this code, where it's outside the definition of the plugin and binding events. Plugins should be built in a way where it is explicitly invoked by the programmers using them, and the 'proper' way is to invoke them from within a $(document).ready() function that is specified by the user in the order that the user wants. Lets pretend, for example, that this plugin is invoked from within another $(document).ready(), in which case the document.ready call from within the plugin is completely redundant and useless.
- cgcardona 15y agoYour points are all valid and I'll consider each one in refactoring the code. Thanks!