From a7f42d9966443342098fc6b40d6ff823c75bb43a Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Mon, 13 May 2013 21:55:00 -0400 Subject: [PATCH] Fix #13835: classes separated by form feed (cherry picked from commit d8a35011ec05ed3493a85c1bd699902893cd437c) --- src/attributes.js | 2 +- test/unit/attributes.js | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/attributes.js b/src/attributes.js index 8a6bf5659..4ea1bd5cf 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|object)$/i, rclickable = /^(?:a|area)$/i, diff --git a/test/unit/attributes.js b/test/unit/attributes.js index b913ce960..aa9d3b48c 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -1357,6 +1357,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 ); -- 2.39.5