From 547570a9b272c0c7d70c996a8139d26a118dd838 Mon Sep 17 00:00:00 2001
From: Phil Mander
Date: Thu, 27 Oct 2011 22:55:25 +0200
Subject: [PATCH 1/6] Signed-off-by: Phil Mander
---
build/google-compiler-20100917.jar | Bin 3939454 -> 3939413 bytes
build/js.jar | Bin 812869 -> 812861 bytes
test/data/text.php | 24 +-
test/delegatetest.html | 484 ++++++++++++++---------------
4 files changed, 254 insertions(+), 254 deletions(-)
diff --git a/build/google-compiler-20100917.jar b/build/google-compiler-20100917.jar
index 4dfa5ad0b9554ceff8720f2e2ab9c3caa25a1d5f..02c76c08079d882140de8311c367aa405745c04a 100644
GIT binary patch
delta 426
zcmWN~Pbjki90%~Q_jxemnHlzO-i_^j&Hwk=*xq;E13ecd+JVU1TS{K##4g;3^dr+I
z!}7M9w&GQ9DPQd}Im(|T<>27L4ob+9gYEqtKIcz*|1s;5{d@7wro2dbvpV0=-kp7?
zCi_4(%Yl7B)gfbiQS~!~6Y~cp39Tr|3#0@ECbC?X$MTsPO0eKsBult}X)VVNaJig)mp*k6@)re=trxAw7CRrCXzvNtYs%F4F~}
z3zSDUDeg3|kBB>s&I&wujq`_?(3$!?bk=2J6*%kqbaIJ^)ts2XuRrFQBf1&3;AXh8
zcbi<=D!8=PJO{NYR
SVC
zaGAtd9mH7u>Til@8dxJDnkL^ANlQ)aE2Jgaqef>~zO95Dmy;?oBxL4bP8br+{VwvQ
on&C^e@DdPR>jBZN;6ij?jm7>>x=U!s?`GfFcjm#4zx6!uALmfE&j0`b
delta 508
zcmW-dUnoOy9L2jcF6OeCF}4}@$NxXqFlOapkT6%^u|QN!KZ`aWx5#a$j~KpSfdLM3b*zkr?99S2wt4-!BkkdW1#bkCw!dXoT0N^kPs
zGwz+wrW6U#mlWwM-l02{RJ)Gd*P#^1Kq`G5%73oVMVx8ECUh=OaXNxcqenrFp7h;8
z_)s*RLeUJl8@*^r>DxlKW6A_sv}014G=JZAs9a~z9=W>Rg5Gae0}c7@*_SuS=XKhX
zF=*30n}&LN>3R8UCZEr0){
z(91vMLX-V`P>eo&%!5i`qVRE5M-4K2xQguI>i>5K*qXHg)@;L-eb#(C%y8SzadR40
RPQeUnK^?G=Q>edQ`UO?fzuW)-
diff --git a/build/js.jar b/build/js.jar
index a76cc7c6b23acae0002e745dabdda30a013dae4c..6658c790932f01de2d5de6516294393360c36a25 100644
GIT binary patch
delta 87
zcmX?l&T#KJ!-g%4AFpr!be(avPy0L-CLm@8VwUamR9GJhZ*Q<*ja$)v{{bryvjH*t
o_WKVwtn9W+$#Z@c+%90qc{q6cl@`wSH|;TnT-##`xnF(-05jq#3;+NC
delta 103
zcmdmc&hY3t!-g%4AFng=ZU+*peHeM$=cq6NF*6XeY@egT`cN1sS8KrAbqxlv;7TFZAc;4_K-sEmtO&=-zh!-
diff --git a/test/data/text.php b/test/data/text.php
index c06ef4b8eb..b9df4cf3bb 100644
--- a/test/data/text.php
+++ b/test/data/text.php
@@ -1,12 +1,12 @@
-Lorem ipsum dolor sit amet
-consectetuer adipiscing elit
-Sed lorem leo
-lorem leo consectetuer adipiscing elit
-Sed lorem leo
-rhoncus sit amet
-elementum at
-bibendum at, eros
-Cras at mi et tortor egestas vestibulum
-sed Cras at mi vestibulum
-Phasellus sed felis sit amet
-orci dapibus semper.
+Lorem ipsum dolor sit amet
+consectetuer adipiscing elit
+Sed lorem leo
+lorem leo consectetuer adipiscing elit
+Sed lorem leo
+rhoncus sit amet
+elementum at
+bibendum at, eros
+Cras at mi et tortor egestas vestibulum
+sed Cras at mi vestibulum
+Phasellus sed felis sit amet
+orci dapibus semper.
diff --git a/test/delegatetest.html b/test/delegatetest.html
index b2840c1292..327085c84b 100644
--- a/test/delegatetest.html
+++ b/test/delegatetest.html
@@ -1,242 +1,242 @@
-
-
-
-
-
-
-
"), x = jq[0];
@@ -1150,6 +1150,8 @@ test("addClass, removeClass, hasClass", function() {
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" );
+
+ ok( !jq.hasClass("CLASS4"), "Check case sensitivity");
jq.removeClass("class2");
ok( jq.hasClass("class2")==false, "Check the class has been properly removed" );
@@ -1177,12 +1179,12 @@ test("hasRel, hasAttrToken", function() {
var $div = jQuery("
Geoff Capes
");
- ok( $div.hasAttrToken("data-name", "geoff"));
- ok( $div.hasAttrToken("data-name", "capes"));
- ok( $div.hasAttrToken("data-name", "love"));
- ok( !$div.hasAttrToken("data-name", "lov"));
- ok( !$div.hasAttrToken("data-name"));
- ok( !$div.hasAttrToken("data-blah"));
+ ok( $div.hasAttrToken("data-name", "geoff"), "Check token is found");
+ ok( $div.hasAttrToken("data-name", "capes"), "Check token is found");
+ ok( $div.hasAttrToken("data-name", "love"), "Check token is found");
+ ok( !$div.hasAttrToken("data-name", "lov"), "Check non existent token not found");
+ ok( !$div.hasAttrToken("data-name"), "Check not attr value not found");
+ ok( !$div.hasAttrToken("data-blah"), "Check non existent attr is false");
var $a = jQuery("Hi");
$a.attr("rel", "author nofollow next");
@@ -1191,11 +1193,11 @@ test("hasRel, hasAttrToken", function() {
$a2.attr("rel", "author next");
$a.add($a2);
- ok( $a.hasRel("author"));
- ok( $a.hasRel("nofollow"));
- ok( $a.hasRel("next"));
- ok( $a.hasRel("AUTHOR"));
- ok( $a.hasRel("NOFOLLOW"));
- ok( $a.hasRel("NEXT"));
- ok( !$a.hasRel("nofollownext"));
+ ok( $a.hasRel("author"), "Check rel is found");
+ ok( $a.hasRel("nofollow"), "Check rel is found");
+ ok( $a.hasRel("next"), "Check rel is found");
+ ok( $a.hasRel("AUTHOR"), "Check rel is found (not case sensitive)");
+ ok( $a.hasRel("NOFOLLOW"), "Check rel is found (not case sensitive)");
+ ok( $a.hasRel("NEXT"), "Check rel is found (not case sensitive)");
+ ok( !$a.hasRel("nofollownext"), "Check rel is not found");
});
\ No newline at end of file
From a85e78df1981ddf8c2320801a85e9e05217cd26b Mon Sep 17 00:00:00 2001
From: Phil Mander
Date: Sat, 29 Oct 2011 00:39:33 +0200
Subject: [PATCH 6/6] Removed hasRel method. Updated tests
Signed-off-by: Phil Mander
---
src/attributes.js | 6 +-----
test/unit/attributes.js | 30 +++++++++++++++---------------
2 files changed, 16 insertions(+), 20 deletions(-)
diff --git a/src/attributes.js b/src/attributes.js
index 063f4558d3..2043eaba79 100644
--- a/src/attributes.js
+++ b/src/attributes.js
@@ -147,17 +147,13 @@ jQuery.fn.extend({
return this.hasAttrToken( "class", selector );
},
- hasRel: function( selector ) {
- return this.hasAttrToken( "rel", selector, true );
- },
-
hasAttrToken: function( attr, selector, ignoreCase ) {
var token = " " + selector + " ",
attrVal,
hasToken,
i = 0,
l = this.length;
-
+
if(ignoreCase === true) {
token = new RegExp(token, "i");
}
diff --git a/test/unit/attributes.js b/test/unit/attributes.js
index 00d780832a..f9a94252f9 100644
--- a/test/unit/attributes.js
+++ b/test/unit/attributes.js
@@ -1173,18 +1173,18 @@ test("contents().hasClass() returns correct values", function() {
ok( !$contents.hasClass("undefined"), "Did not find 'undefined' in $contents (correctly)" );
});
-test("hasRel, hasAttrToken", function() {
+test("hasAttrToken", function() {
expect(13);
- var $div = jQuery("
Geoff Capes
");
+ var $div = jQuery("");
- ok( $div.hasAttrToken("data-name", "geoff"), "Check token is found");
- ok( $div.hasAttrToken("data-name", "capes"), "Check token is found");
- ok( $div.hasAttrToken("data-name", "love"), "Check token is found");
- ok( !$div.hasAttrToken("data-name", "lov"), "Check non existent token not found");
- ok( !$div.hasAttrToken("data-name"), "Check not attr value not found");
- ok( !$div.hasAttrToken("data-blah"), "Check non existent attr is false");
+ ok( $div.hasAttrToken("accesskey", "A"), "Check token is found");
+ ok( $div.hasAttrToken("accesskey", "B"), "Check token is found");
+ ok( $div.hasAttrToken("accesskey", "C"), "Check token is found");
+ ok( !$div.hasAttrToken("accesskey", "a"), "Check token is not found (wrong case)");
+ ok( !$div.hasAttrToken("accesskey", "b"), "Check token is not found (wrong case)");
+ ok( !$div.hasAttrToken("accesskey", "c"), "Check token is not found (wrong case)");
var $a = jQuery("Hi");
$a.attr("rel", "author nofollow next");
@@ -1193,11 +1193,11 @@ test("hasRel, hasAttrToken", function() {
$a2.attr("rel", "author next");
$a.add($a2);
- ok( $a.hasRel("author"), "Check rel is found");
- ok( $a.hasRel("nofollow"), "Check rel is found");
- ok( $a.hasRel("next"), "Check rel is found");
- ok( $a.hasRel("AUTHOR"), "Check rel is found (not case sensitive)");
- ok( $a.hasRel("NOFOLLOW"), "Check rel is found (not case sensitive)");
- ok( $a.hasRel("NEXT"), "Check rel is found (not case sensitive)");
- ok( !$a.hasRel("nofollownext"), "Check rel is not found");
+ ok( $a.hasAttrToken("rel", "author", true), "Check rel is found");
+ ok( $a.hasAttrToken("rel", "nofollow", true), "Check rel is found");
+ ok( $a.hasAttrToken("rel", "next", true), "Check rel is found");
+ ok( $a.hasAttrToken("rel", "AUTHOR", true), "Check rel is found (not case sensitive)");
+ ok( $a.hasAttrToken("rel", "NOFOLLOW", true), "Check rel is found (not case sensitive)");
+ ok( $a.hasAttrToken("rel", "NEXT", true), "Check rel is found (not case sensitive)");
+ ok( !$a.hasAttrToken("rel", "nofollownext", true), "Check rel is not found");
});
\ No newline at end of file