@@ -141,16 +141,22 @@ test("is() with :has() selectors", function() {
141141} ) ;
142142
143143test ( "is() with positional selectors" , function ( ) {
144- expect ( 24 ) ;
145-
146- var isit = function ( sel , match , expect ) {
147- equal ( jQuery ( sel ) . is ( match ) , expect , "jQuery('" + sel + "').is('" + match + "')" ) ;
148- } ;
149-
150- jQuery (
151- "<p id='posp'><a class='firsta' href='#'><em>first</em></a><a class='seconda' href='#'><b>test</b></a><em></em></p>"
152- ) . appendTo ( "#qunit-fixture" ) ;
144+ expect ( 27 ) ;
145+
146+ var
147+ posp = jQuery (
148+ "<p id='posp'><a class='firsta' href='#'><em>first</em></a>" +
149+ "<a class='seconda' href='#'><b>test</b></a><em></em></p>"
150+ ) . appendTo ( "#qunit-fixture" ) ,
151+ isit = function ( sel , match , expect ) {
152+ equal (
153+ jQuery ( sel ) . is ( match ) ,
154+ expect ,
155+ "jQuery('" + sel + "').is('" + match + "')"
156+ ) ;
157+ } ;
153158
159+ isit ( "#posp" , "p:last" , true ) ;
154160 isit ( "#posp" , "#posp:first" , true ) ;
155161 isit ( "#posp" , "#posp:eq(2)" , false ) ;
156162 isit ( "#posp" , "#posp a:first" , false ) ;
@@ -179,6 +185,9 @@ test("is() with positional selectors", function() {
179185 isit ( "#posp em" , "#posp a em:eq(2)" , false ) ;
180186
181187 ok ( jQuery ( "#option1b" ) . is ( "#select1 option:not(:first)" ) , "POS inside of :not() (#10970)" ) ;
188+
189+ ok ( jQuery ( posp [ 0 ] ) . is ( "p:last" ) , "context constructed from a single node (#13797)" ) ;
190+ ok ( ! jQuery ( posp [ 0 ] ) . find ( "#firsta" ) . is ( "a:first" ) , "context derived from a single node (#13797)" ) ;
182191} ) ;
183192
184193test ( "index()" , function ( ) {
0 commit comments