Be specific on the right-hand side of your selector, and less specific on the left.
// unoptimized
$('div.data .gonzalez');
// optimized
$('.data td.gonzalez');
Could someone explain why the less specific left is faster as a CSS selector?
Is this a Sizzle thing or does the same apply for
document.querySelectorAll
?Are there any speed gains using "similarly optimised" CSS selectors in CSS files?