Search code examples
javascriptcsscss-selectorsselectors-api

CSS selectors get evaluated right-to-left. Do querySelectorAll() selectors get evaluated that way too?


Do querySelectorAll() selectors get evaluated right-to-left like CSS ones, or does it do so left-to-right?


Solution

  • It's right to left, this why the right side should be more specific than the left side.

    jQuery selectors should get more specific from left to right. Selectors are parsed in reverse order, so making sure that your most specific selector is on the right will increase performance..

    It says "jQuery" but it's true for all CSS selectors.