Skip to content
Permalink
Browse files

Merge branch 't7673' of https://github.com/jitter/jquery into jitter-…

…t7673
  • Loading branch information...
jeresig committed Dec 6, 2010
2 parents 21d08eb + df0a3fb commit e56d6f676b8fe0e73555d1633c2bce5804edb3da
Showing with 9 additions and 5 deletions.
  1. +1 −1 src/attributes.js
  2. +8 −4 test/unit/attributes.js
@@ -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,17 +739,21 @@ 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" );
jq.removeClass("cla");
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" );
});

0 comments on commit e56d6f6

Please sign in to comment.
You can’t perform that action at this time.