3 ms·
it lets you chain jQuery functions, That's also an anti-pattern. JQuery was designed to hide iteration from designers who can't code. I'm floored that peopl
by wavephorm 15y ago
it lets you chain jQuery functions,
That's also an anti-pattern. JQuery was designed to hide iteration from designers who can't code. I'm floored that people that actually know how to program still think it's a good idea.
$('DIV').click(..).color()...border()...
It might look fancy, but all it's doing is obscuring the fact that iteration might be occurring on each command which for obvious reasons would be a bad idea. A designer might not care, but a programmer who knows JavaScript will probably write something like this instead:
var divs = document.getElementsByTagName('DIV');
divs.forEach(function(div) {
div.onClick = ..
div.style....
});
JQuery provides a nice polyfill for older browsers, but the way the API works just gets in the way for people who know JavaScript and DOM.