2 ms·
> if you use only a select number of methods from jQuery, it would not be hard to emulate the syntax using modern JS methods and wrapping them in a small bit o
by dmitriid 9y ago
> if you use only a select number of methods from jQuery, it would not be hard to emulate the syntax using modern JS methods and wrapping them in a small bit of logic in a much smaller file size than including jQuery itself.
Question is: but why? :) What you do is basically re-implemeting jQuery with an untested code which is largely an unknown quantity. Whereas jQuery has countless little snippets like "We can't cloneNode fragments that contain checked, in WebKit"[1] any "simple, quick, dirty implementation" will not have that.
It's better to use a "select number of methods from jQuery" directly from jQuery than spend any time re-implementing them anew and missing multiple details that jQuery has accumulated over the years. Even is size is an issue. If it really really is an issue, the best approach is to actually extract relevant code from jQuery and not re-implement it.
My original point was: nothing in DOM APIs matches jQuery functionality. All attempts to prove anything otherwise only reinforce my point.
[1] https://github.com/jquery/jquery/blob/master/src/manipulation.js#L139 https://github.com/jquery/jquery/blob/master/src/manipulatio...