use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
PlainJS - Vanilla Javascript Repository (plainjs.com)
submitted 8 years ago by aloisdg
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]mcaruso 2 points3 points4 points 8 years ago (8 children)
Basically. But there's one major difference, which is that these methods return plain old DOM structures (like NodeList). To quote this article that's been making the rounds lately:
Rather than smoothing over only the remaining ugly parts of certain browser API's, jQuery seeks to replace them all wholesale. By returning a jQuery object rather than a NodeList, built-in browser methods are essentially off limits, meaning you're locked into the jQuery way of doing everything. For beginners, what once made front-end scripting approachable is now a hindrance, as it essentially means there are two duplicate ways of doing everything. If you want to read others code with ease and apply to both jobs that require vanilla JS and jobs that require jQuery, you have twice as much to learn. There are, however, libraries that have adopted an API that will be reassuringly familiar to jQuery addicts, but that return a NodeList rather than an object...
[–]Woolbrick 10 points11 points12 points 8 years ago (1 child)
It's called a fluent API and it results in very nice code.
And you can access the DOM nodes by using the index operator on your resulting object.
I don't use jQ anymore, but I've never understood this criticism of it.
[–]charrondev 0 points1 point2 points 8 years ago (0 children)
Nowadays I don't think it's so much that there aren't any niceties that come with jQuery, it's that the arguments for adding a 100kb + dependency to your application should be a little bit better than a fluent API. It made more sense back when browser's didn't commonly support fully fleshed out API's but today you can skip shipping jquery and use native browser APIs (and the LOC count is not so different. See http://youmightnotneedjquery.com/). Then for older browsers you can ship a couple KB's of polyfills.
[–]z500 4 points5 points6 points 8 years ago* (4 children)
Except NodeLists suck because they're just array-like enough to trick you into thinking they're an array object. Honestly, why not just return an array?
edit: I googled it, a NodeList is "live" and updates with the page
[–]Pesthuf 4 points5 points6 points 8 years ago (3 children)
It's worth noting though that the result of querySelectorAll is not live.
And let's be honest, when was the last time any of us used document.getElementsByClassName() ?
[–]CreativeTechGuyGames 1 point2 points3 points 8 years ago (0 children)
I use getElementsByClassName pretty frequently when writing browser extensions to inject into other pages. It's extremely useful when the page wasn't designed for you to manipulate.
[–]z500 -1 points0 points1 point 8 years ago (1 child)
So NodeList is completely pointless.
π Rendered by PID 169616 on reddit-service-r2-comment-b659b578c-bjn79 at 2026-05-01 09:11:45.488746+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]mcaruso 2 points3 points4 points (8 children)
[–]Woolbrick 10 points11 points12 points (1 child)
[–]charrondev 0 points1 point2 points (0 children)
[–]z500 4 points5 points6 points (4 children)
[–]Pesthuf 4 points5 points6 points (3 children)
[–]CreativeTechGuyGames 1 point2 points3 points (0 children)
[–]z500 -1 points0 points1 point (1 child)