diff --git a/src/sizzle b/src/sizzle index 8d91687e6..714672073 160000 --- a/src/sizzle +++ b/src/sizzle @@ -1 +1 @@ -Subproject commit 8d91687e64f137fac70a8f88d361c5bbb688299f +Subproject commit 71467207315eaac67dc6ba00992fe0f7998a8cb4 diff --git a/test/data/testrunner.js b/test/data/testrunner.js index 049be6657..3f6398404 100644 --- a/test/data/testrunner.js +++ b/test/data/testrunner.js @@ -94,7 +94,7 @@ function testSubproject( label, url, risTests ) { fixture = page.find("[id='qunit-fixture']"); fixtureHTML = fixture.html(); fixture.empty(); - while ( fixture.length && !fixture.prevAll("[id^='qunit-']").length ) { + while ( fixture.length && !fixture.prevAll("[id='qunit']").length ) { fixture = fixture.parent(); } fixture = fixture.add( fixture.nextAll() ); @@ -112,7 +112,7 @@ function testSubproject( label, url, risTests ) { // Replace the current fixture, including content outside of #qunit-fixture var oldFixture = originaljQuery("#qunit-fixture"); - while ( oldFixture.length && !oldFixture.prevAll("[id^='qunit-']").length ) { + while ( oldFixture.length && !oldFixture.prevAll("[id='qunit']").length ) { oldFixture = oldFixture.parent(); } oldFixture.nextAll().remove(); diff --git a/test/index.html b/test/index.html index a13188b97..45204e27e 100644 --- a/test/index.html +++ b/test/index.html @@ -82,16 +82,9 @@ -

jQuery Test Suite

-

-
-

-
    +
    -
    -
    -
    @@ -110,6 +103,9 @@

    This link has class="blog": Simon Willison's Weblog

    +
    +
    +

    Try them out:

    diff --git a/test/unit/attributes.js b/test/unit/attributes.js index db18d4543..d3dbd4f17 100644 --- a/test/unit/attributes.js +++ b/test/unit/attributes.js @@ -978,7 +978,7 @@ test( "val(select) after form.reset() (Bug #2551)", function() { var testAddClass = function( valueObj ) { expect( 9 ); - var div = jQuery("div"); + var div = jQuery("#qunit-fixture div"); div.addClass( valueObj("test") ); var pass = true; for ( var i = 0; i < div.size(); i++ ) { @@ -1029,8 +1029,8 @@ test( "addClass(Function)", function() { }); test( "addClass(Function) with incoming value", function() { - expect( 54 ); - var div = jQuery("div"), + expect( 52 ); + var div = jQuery("#qunit-fixture div"), old = div.map(function() { return jQuery(this).attr("class") || ""; }); @@ -1054,7 +1054,7 @@ test( "addClass(Function) with incoming value", function() { var testRemoveClass = function(valueObj) { expect( 8 ); - var $set = jQuery("div"), + var $set = jQuery("#qunit-fixture div"), div = document.createElement("div"); $set.addClass("test").removeClass( valueObj("test") ); @@ -1102,9 +1102,9 @@ test( "removeClass(Function) - simple", function() { }); test( "removeClass(Function) with incoming value", function() { - expect( 54 ); + expect( 52 ); - var $divs = jQuery("div").addClass("test"), old = $divs.map(function() { + var $divs = jQuery("#qunit-fixture div").addClass("test"), old = $divs.map(function() { return jQuery( this ).attr("class"); }); diff --git a/test/unit/event.js b/test/unit/event.js index 78f7fe9af..211d2d852 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -1491,8 +1491,8 @@ test(".live()/.die()", function() { var submit = 0, div = 0, livea = 0, liveb = 0; - jQuery("div").live("submit", function(){ submit++; return false; }); - jQuery("div").live("click", function(){ div++; }); + jQuery("#qunit-fixture div").live("submit", function(){ submit++; return false; }); + jQuery("#qunit-fixture div").live("click", function(){ div++; }); jQuery("div#nothiddendiv").live("click", function(){ livea++; }); jQuery("div#nothiddendivchild").live("click", function(){ liveb++; }); @@ -1571,13 +1571,13 @@ test(".live()/.die()", function() { jQuery("div#nothiddendivchild").die("click"); jQuery("div#nothiddendiv").die("click"); - jQuery("div").die("click"); - jQuery("div").die("submit"); + jQuery("#qunit-fixture div").die("click"); + jQuery("#qunit-fixture div").die("submit"); // Test binding with a different context var clicked = 0, container = jQuery("#qunit-fixture")[0]; jQuery("#foo", container).live("click", function(e){ clicked++; }); - jQuery("div").trigger("click"); + jQuery("#qunit-fixture div").trigger("click"); jQuery("#foo").trigger("click"); jQuery("#qunit-fixture").trigger("click"); jQuery("body").trigger("click"); @@ -2022,8 +2022,8 @@ test(".delegate()/.undelegate()", function() { var submit = 0, div = 0, livea = 0, liveb = 0; - jQuery("#body").delegate("div", "submit", function(){ submit++; return false; }); - jQuery("#body").delegate("div", "click", function(){ div++; }); + jQuery("#body").delegate("#qunit-fixture div", "submit", function(){ submit++; return false; }); + jQuery("#body").delegate("#qunit-fixture div", "click", function(){ div++; }); jQuery("#body").delegate("div#nothiddendiv", "click", function(){ livea++; }); jQuery("#body").delegate("div#nothiddendivchild", "click", function(){ liveb++; }); @@ -2102,13 +2102,13 @@ test(".delegate()/.undelegate()", function() { jQuery("#body").undelegate("div#nothiddendivchild", "click"); jQuery("#body").undelegate("div#nothiddendiv", "click"); - jQuery("#body").undelegate("div", "click"); - jQuery("#body").undelegate("div", "submit"); + jQuery("#body").undelegate("#qunit-fixture div", "click"); + jQuery("#body").undelegate("#qunit-fixture div", "submit"); // Test binding with a different context var clicked = 0, container = jQuery("#qunit-fixture")[0]; jQuery("#qunit-fixture").delegate("#foo", "click", function(e){ clicked++; }); - jQuery("div").trigger("click"); + jQuery("#qunit-fixture div").trigger("click"); jQuery("#foo").trigger("click"); jQuery("#qunit-fixture").trigger("click"); jQuery("body").trigger("click"); diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index c32001bab..9d8c93321 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -1459,7 +1459,7 @@ test( "clone()", function() { equal( jQuery(form).clone().children().length, 1, "Make sure we just get the form back." ); body = jQuery("body").clone(); - equal( body.children()[ 0 ].id, "qunit-header", "Make sure cloning body works" ); + equal( body.children()[ 0 ].id, "qunit", "Make sure cloning body works" ); body.remove(); }); @@ -1612,7 +1612,7 @@ var testHtml = function( valueObj ) { expected.push("B"); actual.push( childNodeNames( this ) ); }); - equal( expected.length, 6, "Expecting many parents" ); + equal( expected.length, 7, "Expecting many parents" ); deepEqual( actual, expected, "Correct childNodes after setting HTML" ); actual = []; expected = []; diff --git a/test/unit/offset.js b/test/unit/offset.js index 3516016e5..81f36f2d7 100644 --- a/test/unit/offset.js +++ b/test/unit/offset.js @@ -487,13 +487,13 @@ test("offsetParent", function(){ equal( body.length, 1, "Only one offsetParent found." ); equal( body[0], document.documentElement, "The html element is the offsetParent of the body." ); - var header = jQuery("#qunit-header").offsetParent(); + var header = jQuery("#qunit").offsetParent(); equal( header.length, 1, "Only one offsetParent found." ); - equal( header[0], document.documentElement, "The html element is the offsetParent of the body." ); + equal( header[0], document.documentElement, "The html element is the offsetParent of #qunit." ); var div = jQuery("#nothiddendivchild").offsetParent(); equal( div.length, 1, "Only one offsetParent found." ); - equal( div[0], document.documentElement, "The html element is the offsetParent of the body." ); + equal( div[0], document.getElementById("qunit-fixture"), "The #qunit-fixture is the offsetParent of #nothiddendivchild." ); jQuery("#nothiddendiv").css("position", "relative"); diff --git a/test/unit/selector.js b/test/unit/selector.js index 899d06ee1..2a7aa39d2 100644 --- a/test/unit/selector.js +++ b/test/unit/selector.js @@ -7,10 +7,12 @@ module("selector - jQuery only", { teardown: moduleTeardown }); test("element - jQuery only", function() { expect( 7 ); - deepEqual( jQuery("p", document.getElementsByTagName("div")).get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a context." ); - deepEqual( jQuery("p", "div").get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a context." ); - deepEqual( jQuery("p", jQuery("div")).get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a context." ); - deepEqual( jQuery("div").find("p").get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a context." ); + var fixture = document.getElementById("qunit-fixture"); + + deepEqual( jQuery("p", fixture).get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a Node context." ); + deepEqual( jQuery("p", "#qunit-fixture").get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a selector context." ); + deepEqual( jQuery("p", jQuery("#qunit-fixture")).get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a jQuery object context." ); + deepEqual( jQuery("#qunit-fixture").find("p").get(), q("firstp","ap","sndp","en","sap","first"), "Finding elements with a context via .find()." ); ok( jQuery("#length").length, " cannot be found under IE, see #945" ); ok( jQuery("#lengthtest input").length, " cannot be found under IE, see #945" ); @@ -44,7 +46,7 @@ if ( jQuery.css ) { test("pseudo - visibility", function() { expect( 9 ); - t( "Is Visible", "div:visible:not(#qunit-testrunner-toolbar):lt(2)", ["nothiddendiv", "nothiddendivchild"] ); + t( "Is Visible", "#qunit-fixture div:visible:lt(2)", ["foo", "nothiddendiv"] ); t( "Is Not Hidden", "#qunit-fixture:hidden", [] ); t( "Is Hidden", "#form input:hidden", ["hidden1","hidden2"] ); diff --git a/test/unit/traversing.js b/test/unit/traversing.js index 6e50e1cc4..9388089b2 100644 --- a/test/unit/traversing.js +++ b/test/unit/traversing.js @@ -9,7 +9,7 @@ test( "find(String)", function() { equal( j.find("div").length, 0, "Check node,textnode,comment to find zero divs" ); equal( j.find("div").andSelf().length, 3, "Check node,textnode,comment to find zero divs, but preserves pushStack" ); - deepEqual( jQuery("#qunit-fixture").find("> div").get(), q( "foo", "moretests", "tabindex-tests", "liveHandlerOrder", "siblingTest", "fx-test-group" ), "find child elements" ); + deepEqual( jQuery("#qunit-fixture").find("> div").get(), q( "foo", "nothiddendiv", "moretests", "tabindex-tests", "liveHandlerOrder", "siblingTest", "fx-test-group" ), "find child elements" ); deepEqual( jQuery("#qunit-fixture").find("> #foo, > #moretests").get(), q( "foo", "moretests" ), "find child elements" ); deepEqual( jQuery("#qunit-fixture").find("> #foo > p").get(), q( "sndp", "en", "sap" ), "find child elements" ); @@ -286,8 +286,8 @@ test("closest()", function() { deepEqual( jQuery("body").closest("div").get(), [], "closest(div)" ); deepEqual( jQuery("#qunit-fixture").closest("span,#html").get(), q("html"), "closest(span,#html)" ); - deepEqual( jQuery("div:eq(1)").closest("div:first").get(), [], "closest(div:first)" ); - deepEqual( jQuery("div").closest("body:first div:last").get(), q("fx-tests"), "closest(body:first div:last)" ); + deepEqual( jQuery("#qunit-fixture").closest("div:first").get(), [], "closest(div:first)" ); + deepEqual( jQuery("#qunit-fixture div").closest("body:first div:last").get(), q("fx-tests"), "closest(body:first div:last)" ); // Test .closest() limited by the context var jq = jQuery("#nothiddendivchild"); @@ -312,15 +312,15 @@ test("closest(jQuery)", function() { expect(8); var $child = jQuery("#nothiddendivchild"), $parent = jQuery("#nothiddendiv"), - $main = jQuery("#qunit-fixture"), + $sibling = jQuery("#foo"), $body = jQuery("body"); ok( $child.closest( $parent ).is("#nothiddendiv"), "closest( jQuery('#nothiddendiv') )" ); ok( $child.closest( $parent[0] ).is("#nothiddendiv"), "closest( jQuery('#nothiddendiv') ) :: node" ); ok( $child.closest( $child ).is("#nothiddendivchild"), "child is included" ); ok( $child.closest( $child[0] ).is("#nothiddendivchild"), "child is included :: node" ); equal( $child.closest( document.createElement("div") ).length, 0, "created element is not related" ); - equal( $child.closest( $main ).length, 0, "Main not a parent of child" ); - equal( $child.closest( $main[0] ).length, 0, "Main not a parent of child :: node" ); + equal( $child.closest( $sibling ).length, 0, "Sibling not a parent of child" ); + equal( $child.closest( $sibling[0] ).length, 0, "Sibling not a parent of child :: node" ); ok( $child.closest( $body.add($parent) ).is("#nothiddendiv"), "Closest ancestor retrieved." ); });