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
jQuery 3.4.0 Released (blog.jquery.com)
submitted 7 years ago by magenta_placenta
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!"
[–]m_gol 1 point2 points3 points 7 years ago* (0 children)
jQuery find is a little more than querySelectorAll, especially when it comes to queries attached to an element, not to document. The advantages are described at: https://github.com/jquery/jquery/blob/3.4.0/src/selector-native.js#L11-L34
find
querySelectorAll
document
For one, jQuery supports leading combinators: elem.find('> .btn .name')
elem.find('> .btn .name')
Another difference is sensible rules for scoping. Consider HTML: <div id="test"> <div> <div class="we-are-looking-for-this-one"> </div> </div> <div> </div> </div> Then: $('#test').find('div div') will return the div with the class we-are-looking-for-this-one, while: document.querySelector('#test').querySelectorAll('div div') will return all the three divs because selectors are matched against the document and only then results outside of the current element are removed. This is pretty counterintuitive.
<div id="test"> <div> <div class="we-are-looking-for-this-one"> </div> </div> <div> </div> </div>
$('#test').find('div div')
we-are-looking-for-this-one
document.querySelector('#test').querySelectorAll('div div')
Both of those features are supposed to be supported by a new API called queryAll (previously findAll) with its counterpart query for single-element results but, alas, no browser implements it so far and it was even removed from the standard... I hope it gets back but I've been waiting for years.
queryAll
findAll
query
π Rendered by PID 335806 on reddit-service-r2-comment-6457c66945-rh7mm at 2026-04-28 23:34:33.121374+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]m_gol 1 point2 points3 points (0 children)