From: Richard Gibson Date: Tue, 14 May 2013 01:55:00 +0000 (-0400) Subject: Fix #13835: classes separated by form feed X-Git-Tag: 2.0.1~8 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d8a35011ec05ed3493a85c1bd699902893cd437c;p=jquery.git Fix #13835: classes separated by form feed --- diff --git a/src/attributes.js b/src/attributes.js index ace917e91..f7525755f 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -1,5 +1,5 @@ var nodeHook, boolHook, - rclass = /[\t\r\n]/g, + rclass = /[\t\r\n\f]/g, rreturn = /\r/g, rfocusable = /^(?:input|select|textarea|button)$/i; diff --git a/test/unit/attributes.js b/test/unit/attributes.js index 062dd504c..84ac8c2b2 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -1353,6 +1353,26 @@ test( "contents().hasClass() returns correct values", function() { ok( !$contents.hasClass("undefined"), "Did not find 'undefined' in $contents (correctly)" ); }); +test( "hasClass correctly interprets non-space separators (#13835)", function() { + expect( 4 ); + + var + map = { + tab: " ", + "line-feed": " ", + "form-feed": " ", + "carriage-return": " " + }, + classes = jQuery.map( map, function( separator, label ) { + return " " + separator + label + separator + " "; + }), + $div = jQuery( "
" ); + + jQuery.each( map, function( label ) { + ok( $div.hasClass( label ), label.replace( "-", " " ) ); + }); +}); + test( "coords returns correct values in IE6/IE7, see #10828", function() { expect( 1 );