From doc:
$(selector, context) internally implements the .find() method.
But when we write some selector like;
$('#a .b .c')
or
$('#a > .b > .c')
etc.
Does this implement .find() method? or something else mechanism jQuery used for this.
Please make me clear about this parsing mechanism.
Modern implementations will hand the selector over to
document.querySelectorAll()where the browser will attempt to parse it as a CSS selector (assuming it is valid).Failing that, jQuery falls back to its own selector engine, Sizzle, which uses internal methods and calculations to traverse the DOM when implementing the descendant and sibling selectors, which most likely don’t employ methods like
.find()as that would incur unnecessary overhead.