Skip to content

Commit

Permalink
Selector: Detect incorrect escape handling by old Firefox
Browse files Browse the repository at this point in the history
According to:
https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
the escape doesn't need to be followed by a whitespace only if it's not a hex
digit or a newline. However, old Firefox (3.6 - 5 only) doesn't throw if an
escaped newline is not followed by a space. Fallback to Sizzle in such cases.

Fixes jquerygh-454
  • Loading branch information
mgol committed Aug 20, 2019
1 parent 5d90d4f commit 63ffa98
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/sizzle.js
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,12 @@ setDocument = Sizzle.setDocument = function( node ) {
rbuggyQSA.push( ":enabled", ":disabled" );
}

// Support: Firefox <=3.6 - 5 only
// Old Firefox doesn't throw on a badly-escaped identifier.
el.querySelectorAll( "x\\\f" );
rbuggyQSA.push( "[\\r\\n\\f]" );

// Support: Opera 10 - 11 only
// Opera 10-11 does not throw on post-comma invalid pseudos
el.querySelectorAll( "*,:x" );
rbuggyQSA.push( ",.*:" );
Expand Down

0 comments on commit 63ffa98

Please sign in to comment.