From ac5f7cd8e29ecc7cdf21c13199be5472375ffa0e Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Tue, 20 Aug 2019 14:05:37 -0400 Subject: [PATCH] Tests: Port changes from Sizzle Ref https://github.com/jquery/sizzle/pull/450 Closes gh-4464 --- test/unit/selector.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/unit/selector.js b/test/unit/selector.js index 2c17b8682..779b554e7 100644 --- a/test/unit/selector.js +++ b/test/unit/selector.js @@ -221,8 +221,8 @@ QUnit.test( "broken selectors throw", function( assert ) { .appendTo( "#qunit-fixture" ); broken( "Attribute equals non-value", "input[name=]" ); - broken( "Attribute equals unquoted non-identifer", "input[name=foo.baz]" ); - broken( "Attribute equals unquoted non-identifer", "input[name=foo[baz]]" ); + broken( "Attribute equals unquoted non-identifier", "input[name=foo.baz]" ); + broken( "Attribute equals unquoted non-identifier", "input[name=foo[baz]]" ); broken( "Attribute equals bad string", "input[name=''double-quoted'']" ); broken( "Attribute equals bad string", "input[name='apostrophe'd']" ); } ); @@ -638,7 +638,7 @@ QUnit.test( "attributes - hyphen-prefix matches", function( assert ) { } ); QUnit.test( "attributes - special characters", function( assert ) { - assert.expect( 14 ); + assert.expect( 16 ); var attrbad; var div = document.createElement( "div" ); @@ -656,6 +656,7 @@ QUnit.test( "attributes - special characters", function( assert ) { "" + "" + "" + + "" + "" + "" + "" + @@ -678,6 +679,13 @@ QUnit.test( "attributes - special characters", function( assert ) { q( "attrbad_injection" ), "string containing quote and right bracket" ); + assert.deepEqual( jQuery.find( "input[value=\\30 \\30\\37 ]", null, null, attrbad ), + q( "attrbad_leading_digits" ), + "identifier containing escaped leading digits with whitespace termination" ); + assert.deepEqual( jQuery.find( "input[value=\\00003007]", null, null, attrbad ), + q( "attrbad_leading_digits" ), + "identifier containing escaped leading digits without whitespace termination" ); + assert.deepEqual( jQuery.find( "input[data-attr='\\'']", null, null, attrbad ), q( "attrbad_quote" ), "string containing quote" );