equals( jQuery("foo_bar", xml).length, 1, "Element Selector with underscore" );
equals( jQuery("property[name=prop2]", xml).length, 1, "Attribute selector with name" );
equals( jQuery("[name=prop2]", xml).length, 1, "Attribute selector with name" );
- equals( jQuery("#seite1", xml).length, 1, "Attribute selector with name" );
- equals( jQuery("component#seite1", xml).length, 1, "Attribute selector with name" );
+ equals( jQuery("#seite1", xml).length, 1, "Attribute selector with ID" );
+ equals( jQuery("component#seite1", xml).length, 1, "Attribute selector with ID" );
start();
});
});
});
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", [] );
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"] );
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() {
});
test("attributes", function() {
- expect(35);
+ expect(40);
t( "Attribute Exists", "a[title]", ["google"] );
t( "Attribute Exists", "*[title]", ["google"] );
t( "Attribute Exists", "[title]", ["google"] );
t( "for Attribute", "form label[for]", ["label-for"] );
t( "for Attribute in form", "#form [for=action]", ["label-for"] );
+
+ jQuery("form input")[0].test = 0;
+ jQuery("form input")[1].test = 1;
+
+ t( "Expando attribute", "form input[test]", ["text1", "text2"] );
+ t( "Expando attribute value", "form input[test=0]", ["text1"] );
+ t( "Expando attribute value", "form input[test=1]", ["text2"] );
t( "Attribute containing []", "input[name^='foo[']", ["hidden2"] );
t( "Attribute containing []", "input[name^='foo[bar]']", ["hidden2"] );
t( "Attribute Ends With", "a[href $= 'org/']", ["mark"] );
t( "Attribute Contains", "a[href *= 'google']", ["google","groups"] );
t( "Attribute Is Not Equal", "#ap a[hreflang!='en']", ["google","groups","anchor1"] );
+
+ t("Empty values", "#select1 option[value='']", ["option1a"]);
+ t("Empty values", "#select1 option[value!='']", ["option1b","option1c","option1d"]);
t("Select options via :selected", "#select1 option:selected", ["option1a"] );
t("Select options via :selected", "#select2 option:selected", ["option2d"] );
t( "Check position filtering", "select:lt(2) :not(:first)", ["option1b", "option1c", "option1d", "option2a", "option2b", "option2c", "option2d"] );
t( "Check position filtering", "div.nothiddendiv:eq(0)", ["nothiddendiv"] );
t( "Check position filtering", "div.nothiddendiv:last", ["nothiddendiv"] );
- t( "Check position filtering", "div.nothiddendiv:not(:gt(0))", ["nothiddendiv"] );
+ t( "Check position filtering", "div.nothiddendiv:not(:lt(0))", ["nothiddendiv"] );
t( "Check element position", "div div:eq(0)", ["nothiddendivchild"] );
t( "Check element position", "div div:eq(5)", ["fadeout"] );