Over the weekend I ran into one of those situations where it felt like I had found a bug in a very commonly used portion of a very commonly used piece of software (jQuery). Of course, 99.99% of the time when that happens, I’m wrong, not the software.
:contains allows you to select DOM elements which contain text. For instance, you would use a query like:
to select this HTML:
$( 'legend:contains( "Options" )' )
:contains failing all over the place.
To be fair, jQuery and Sizzle never promised that white space would be okay here. I can’t claim this is a bug, just unexpected behavior.
Try it out with a jsfiddle.