Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Don't tokenize trailing commas. Fixes jQuery bug #12643. Closes gh-158.

  • Loading branch information...
commit 3ed4e970e262230c799eaf24cc6d889828a3d6f3 1 parent 6bdb6a9
@gibson042 gibson042 authored timmywil committed
Showing with 4 additions and 2 deletions.
  1. +2 −1  sizzle.js
  2. +2 −1  test/unit/selector.js
View
3  sizzle.js
@@ -1029,7 +1029,8 @@ function tokenize( selector, parseOnly ) {
// Comma and first run
if ( !matched || (match = rcomma.exec( soFar )) ) {
if ( match ) {
- soFar = soFar.slice( match[0].length );
+ // Don't consume trailing commas as valid
+ soFar = soFar.slice( match[0].length ) || soFar;
}
groups.push( tokens = [] );
}
View
3  test/unit/selector.js
@@ -164,7 +164,7 @@ test("XML Document Selectors", function() {
});
test("broken", function() {
- expect( 21 );
+ expect( 22 );
function broken( name, selector ) {
raises(function() {
@@ -183,6 +183,7 @@ test("broken", function() {
broken( "Broken Selector", "{}" );
broken( "Broken Selector", "," );
broken( "Broken Selector", ",a" );
+ broken( "Broken Selector", "a," );
// Hangs on IE 9 if regular expression is inefficient
broken( "Broken Selector", "[id=012345678901234567890123456789");
broken( "Doesn't exist", ":visble" );
Please sign in to comment.
Something went wrong with that request. Please try again.