Handle carriage return characters in className property. Fixes #7673.
This commit is contained in:
parent
e1d6edf822
commit
df0a3fb853
2 changed files with 9 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
|||
(function( jQuery ) {
|
||||
|
||||
var rclass = /[\n\t]/g,
|
||||
var rclass = /[\n\t\r]/g,
|
||||
rspaces = /\s+/,
|
||||
rreturn = /\r/g,
|
||||
rspecialurl = /^(?:href|src|style)$/,
|
||||
|
|
|
@ -719,7 +719,7 @@ test("toggleClass(Fucntion[, boolean]) with incoming value", function() {
|
|||
});
|
||||
|
||||
test("addClass, removeClass, hasClass", function() {
|
||||
expect(14);
|
||||
expect(17);
|
||||
|
||||
var jq = jQuery("<p>Hi</p>"), x = jq[0];
|
||||
|
||||
|
@ -739,12 +739,14 @@ test("addClass, removeClass, hasClass", function() {
|
|||
ok( jq.hasClass("hi"), "Check has1" );
|
||||
ok( jq.hasClass("bar"), "Check has2" );
|
||||
|
||||
var jq = jQuery("<p class='class1\nclass2\tcla.ss3\n'></p>");
|
||||
ok( jq.hasClass("class1"), "Check hasClass with carriage return" );
|
||||
ok( jq.is(".class1"), "Check is with carriage return" );
|
||||
var jq = jQuery("<p class='class1\nclass2\tcla.ss3\n\rclass4'></p>");
|
||||
ok( jq.hasClass("class1"), "Check hasClass with line feed" );
|
||||
ok( jq.is(".class1"), "Check is with line feed" );
|
||||
ok( jq.hasClass("class2"), "Check hasClass with tab" );
|
||||
ok( jq.is(".class2"), "Check is with tab" );
|
||||
ok( jq.hasClass("cla.ss3"), "Check hasClass with dot" );
|
||||
ok( jq.hasClass("class4"), "Check hasClass with carriage return" );
|
||||
ok( jq.is(".class4"), "Check is with carriage return" );
|
||||
|
||||
jq.removeClass("class2");
|
||||
ok( jq.hasClass("class2")==false, "Check the class has been properly removed" );
|
||||
|
@ -752,4 +754,6 @@ test("addClass, removeClass, hasClass", function() {
|
|||
ok( jq.hasClass("cla.ss3"), "Check the dotted class has not been removed" );
|
||||
jq.removeClass("cla.ss3");
|
||||
ok( jq.hasClass("cla.ss3")==false, "Check the dotted class has been removed" );
|
||||
jq.removeClass("class4");
|
||||
ok( jq.hasClass("class4")==false, "Check the class has been properly removed" );
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue