aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/selector.js
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2009-02-07 16:54:11 +0000
committerJohn Resig <jeresig@gmail.com>2009-02-07 16:54:11 +0000
commit2b7642cff025be3b8ac019ae77f2f19ecd07fa87 (patch)
tree661d72e5085d63e7272dfb8fb0c5f1d35304db7b /test/unit/selector.js
parentce00f88ae20b3b569138435c6dd87f44bf5d2be0 (diff)
downloadjquery-2b7642cff025be3b8ac019ae77f2f19ecd07fa87.tar.gz
jquery-2b7642cff025be3b8ac019ae77f2f19ecd07fa87.zip
Added logic for not using getElementsByClassName in different failure states. Fixes jQuery bugs #4058 and #4042.
Diffstat (limited to 'test/unit/selector.js')
-rw-r--r--test/unit/selector.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/test/unit/selector.js b/test/unit/selector.js
index 11112a5c7..e85fce7fd 100644
--- a/test/unit/selector.js
+++ b/test/unit/selector.js
@@ -56,7 +56,7 @@ test("broken", function() {
});
test("id", function() {
- expect(25);
+ expect(27);
t( "ID Selector", "#body", ["body"] );
t( "ID Selector w/ Element", "body#body", ["body"] );
t( "ID Selector w/ Element", "ul#first", [] );
@@ -89,10 +89,13 @@ test("id", function() {
t( "ID selector with non-existant ancestor", "#asdfasdf #foobar", [] ); // bug #986
isSet( jQuery("body").find("div#form"), [], "ID selector within the context of another element" );
+
+ t( "Underscore ID", "#types_all", ["types_all"] );
+ t( "Dash ID", "#fx-queue", ["fx-queue"] );
});
test("class", function() {
- expect(16);
+ expect(18);
t( "Class Selector", ".blog", ["mark","simon"] );
t( "Class Selector", ".GROUPS", ["groups"] );
t( "Class Selector", ".blog.link", ["simon"] );
@@ -112,6 +115,14 @@ test("class", function() {
t( "Descendant scaped Class", "div .test\\.foo\\[5\\]bar", ["test.foo[5]bar"] );
t( "Child escaped Class", "form > .foo\\:bar", ["foo:bar"] );
t( "Child escaped Class", "form > .test\\.foo\\[5\\]bar", ["test.foo[5]bar"] );
+
+ var div = document.createElement("div");
+ div.innerHTML = "<div class='test e'></div><div class='test'></div>";
+ isSet( jQuery(".e", div), [ div.firstChild ], "Finding a second class." );
+
+ div.lastChild.className = "e";
+
+ isSet( jQuery(".e", div), [ div.firstChild, div.lastChild ], "Finding a modified class." );
});
test("name", function() {