You can basically sum up this entire rather ridiculous site with "Yes, you don't need jQuery, you can just use the built-in methods, but using jQuery is generally more pleasant, more consistent, and involves less typing". One particularly egregious example from the site: $('#foo').removeClass('bold'); vs. document.getElementById('foo').className = document.getElementById('foo').className.replace(/^bold$/, ''); The au…
Actually since forever, you don't need to use document.getElementById("x") in any case. You just by putting the id to the element, it is already available to you referencing it by such id. So this: document.getElementById('foo').className = document.getElementById('foo').className.replace(/^bold$/, ''); Can become to this: foo.classList.remove("x"); And is miles away more performant than slow jQuery.
You Don't Need JQuery
101–110 of 201 posts
Re: You Don't Need JQuery
#102You can basically sum up this entire rather ridiculous site with "Yes, you don't need jQuery, you can just use the built-in methods, but using jQuery is generally more pleasant, more consistent, and involves less typing". One particularly egregious example from the site: $('#foo').removeClass('bold'); vs. document.getElementById('foo').className = document.getElementById('foo').className.replace(/^bold$/, ''); The au…
also it hides the discrepancies between the various browsers
The real value of this site is not what it says, but rather a reminder that jQuery is an abstraction and is made of code rather than magick.
Re: You Don't Need JQuery
#103Every time I try to build something without jQuery, I regret it. Not because of selectors, that's (sometimes) easy to do for lots of (basic) selectors. Not because of DOM manipulation, as long as you're willing to sacrifice simplicity and readability, you can build iterative loops to modify a collection of HTML elements. No, it's the unexpected things that cause me pain. Want to use event handlers on dynamically gene…
Life is definitely too short to not be using npm, browserify and React! https://www.npmjs.com/package/browserify https://www.npmjs.com/package/react And then use just what modules you need. All the functionality of jQuery has already been ported to various modules. https://www.npmjs.com/package/extend https://www.npmjs.com/package/promise https://www.npmjs.com/package/serialize-form
Doing the simple, effective thing is just crazy talk, I tell you.
Re: You Don't Need JQuery
#104Re: You Don't Need JQuery
#105Earlier quoted context omitted.
Actually since forever, you don't need to use document.getElementById("x") in any case. You just by putting the id to the element, it is already available to you referencing it by such id. So this: document.getElementById('foo').className = document.getElementById('foo').className.replace(/^bold$/, ''); Can become to this: foo.classList.remove("x"); And is miles away more performant than slow jQuery.
That won't work on Android 2.x, which doesn't support `.classList`. Performance isn't even an issue here since changing classes will cause a reapply-styles and layout.
Re: You Don't Need JQuery
#106Every time I try to build something without jQuery, I regret it. Not because of selectors, that's (sometimes) easy to do for lots of (basic) selectors. Not because of DOM manipulation, as long as you're willing to sacrifice simplicity and readability, you can build iterative loops to modify a collection of HTML elements. No, it's the unexpected things that cause me pain. Want to use event handlers on dynamically gene…
Yeah, the problem with jQuery is all that other stuff that nobody uses and backwards compatibility with browsers nobody supports. A "lite" jQuery with the same familiar API but a stripped-down featureset for higher performance and smaller size would be nice.
Re: You Don't Need JQuery
#107Earlier quoted context omitted.
and slowing down your website
jQuery is usually cached in your browser because of how common it is. From what I understand, the slowing is negligible. Part of a developer's role is to mitigate site performance with the speed of process. Inlining of critical CSS is one way to balance out initial page load, for example.
Re: You Don't Need JQuery
#108Earlier quoted context omitted.
That won't work on Android 2.x, which doesn't support `.classList`. Performance isn't even an issue here since changing classes will cause a reapply-styles and layout.
I care as much for Android 2.x as ie below 10.
Re: You Don't Need JQuery
#109$ = document.querySelector.bind(document); $$ = document.querySelectorAll.bind(document);
Re: You Don't Need JQuery
#110Yeah, you don't need anything. You can write all your apps in vanilla JS, but if you feel like speeding up development...
and slowing down your website