+ t( "Element Preceded By", "p ~ div", ["foo", "moretests","tabindex-tests", "liveHandlerOrder", "siblingTest"] );
+ t( "Element Preceded By", "#first ~ div", ["moretests","tabindex-tests", "liveHandlerOrder", "siblingTest"] );
+ t( "Element Preceded By", "#groups ~ a", ["mark"] );
+ t( "Element Preceded By", "#length ~ input", ["idTest"] );
+ t( "Element Preceded By", "#siblingfirst ~ em", ["siblingnext"] );
+ same( jQuery("#siblingfirst").find("~ em").get(), q("siblingnext"), "Element Preceded By with a context." );
+ same( jQuery("#siblingfirst").find("+ em").get(), q("siblingnext"), "Element Directly Preceded By with a context." );
+ var a = jQuery("<div id='foo'></div><p id='bar'></p><p id='bar2'></p>");
+ same( jQuery("~ p", a[0]).get(), [a[1], a[2]], "Detached Element Directly Preceded By with a context." );
+ same( jQuery("+ p", a[0]).get(), [a[1]], "Detached Element Preceded By with a context." );
+
+ t( "Verify deep class selector", "div.blah > p > a", [] );
+
+ t( "No element deep selector", "div.foo > span > a", [] );
+
+ same( jQuery("> :first", document.getElementById("nothiddendiv")).get(), q("nothiddendivchild"), "Verify child context positional selctor" );
+ same( jQuery("> :eq(0)", document.getElementById("nothiddendiv")).get(), q("nothiddendivchild"), "Verify child context positional selctor" );
+ same( jQuery("> *:first", document.getElementById("nothiddendiv")).get(), q("nothiddendivchild"), "Verify child context positional selctor" );
+
+ t( "Non-existant ancestors", ".fototab > .thumbnails > a", [] );
+});
+
+test("attributes", function() {
+ expect(41);
+
+ t( "Attribute Exists", "a[title]", ["google"] );
+ t( "Attribute Exists", "*[title]", ["google"] );
+ t( "Attribute Exists", "[title]", ["google"] );
+ t( "Attribute Exists", "a[ title ]", ["google"] );
+
+ t( "Attribute Equals", "a[rel='bookmark']", ["simon1"] );
+ t( "Attribute Equals", 'a[rel="bookmark"]', ["simon1"] );
+ t( "Attribute Equals", "a[rel=bookmark]", ["simon1"] );
+ t( "Attribute Equals", "a[href='http://www.google.com/']", ["google"] );
+ t( "Attribute Equals", "a[ rel = 'bookmark' ]", ["simon1"] );
+
+ document.getElementById("anchor2").href = "#2";
+ t( "href Attribute", "p a[href^=#]", ["anchor2"] );
+ t( "href Attribute", "p a[href*=#]", ["simon1", "anchor2"] );
+
+ t( "for Attribute", "form label[for]", ["label-for"] );
+ t( "for Attribute in form", "#form [for=action]", ["label-for"] );
+
+ t( "Attribute containing []", "input[name^='foo[']", ["hidden2"] );
+ t( "Attribute containing []", "input[name^='foo[bar]']", ["hidden2"] );
+ t( "Attribute containing []", "input[name*='[bar]']", ["hidden2"] );
+ t( "Attribute containing []", "input[name$='bar]']", ["hidden2"] );
+ t( "Attribute containing []", "input[name$='[bar]']", ["hidden2"] );
+ t( "Attribute containing []", "input[name$='foo[bar]']", ["hidden2"] );
+ t( "Attribute containing []", "input[name*='foo[bar]']", ["hidden2"] );
+
+ t( "Multiple Attribute Equals", "#form input[type='radio'], #form input[type='hidden']", ["radio1", "radio2", "hidden1"] );
+ t( "Multiple Attribute Equals", "#form input[type='radio'], #form input[type=\"hidden\"]", ["radio1", "radio2", "hidden1"] );
+ t( "Multiple Attribute Equals", "#form input[type='radio'], #form input[type=hidden]", ["radio1", "radio2", "hidden1"] );
+
+ t( "Attribute selector using UTF8", "span[lang=中文]", ["台北"] );
+
+ t( "Attribute Begins With", "a[href ^= 'http://www']", ["google","yahoo"] );
+ 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"] );
+
+ var opt = document.getElementById("option1a"),
+ match = (window.Sizzle || window.jQuery.find).matchesSelector;
+
+ opt.setAttribute("test", "");
+
+ ok( match( opt, "[id*=option1][type!=checkbox]" ), "Attribute Is Not Equal Matches" );
+ ok( match( opt, "[id*=option1]" ), "Attribute With No Quotes Contains Matches" );
+ ok( match( opt, "[test=]" ), "Attribute With No Quotes No Content Matches" );
+ ok( match( opt, "[id=option1a]" ), "Attribute With No Quotes Equals Matches" );
+ ok( match( document.getElementById("simon1"), "a[href*=#]" ), "Attribute With No Quotes Href Contains Matches" );
+
+ 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("Select options via :selected", "#select3 option:selected", ["option3b", "option3c"] );
+
+ t( "Grouped Form Elements", "input[name='foo[bar]']", ["hidden2"] );
+
+ // Make sure attribute value quoting works correctly. See: #6093
+ var attrbad = jQuery('<input type="hidden" value="2" name="foo.baz" id="attrbad1"/><input type="hidden" value="2" name="foo[baz]" id="attrbad2"/>').appendTo("body");
+
+ t("Find escaped attribute value", "input[name=foo\\.baz]", ["attrbad1"]);
+ t("Find escaped attribute value", "input[name=foo\\[baz\\]]", ["attrbad2"]);
+
+ attrbad.remove();
+});
+
+test("pseudo - child", function() {
+ expect(38);
+ t( "First Child", "p:first-child", ["firstp","sndp"] );
+ t( "Last Child", "p:last-child", ["sap"] );
+ t( "Only Child", "#main a:only-child", ["simon1","anchor1","yahoo","anchor2","liveLink1","liveLink2"] );
+ t( "Empty", "ul:empty", ["firstUL"] );
+ t( "Is A Parent", "p:parent", ["firstp","ap","sndp","en","sap","first"] );
+