Navigation Menu

Skip to content

Commit

Permalink
Merge branch 'master' of github.com:jquery/jquery
Browse files Browse the repository at this point in the history
  • Loading branch information
jeresig committed Apr 17, 2011
2 parents d46042e + 230a50f commit 7a8fac5
Show file tree
Hide file tree
Showing 13 changed files with 171 additions and 171 deletions.
44 changes: 22 additions & 22 deletions src/effects.js
Expand Up @@ -173,7 +173,7 @@ jQuery.fn.extend({
this.style.display = "inline-block";

} else {
var display = defaultDisplay(this.nodeName);
display = defaultDisplay(this.nodeName);

// inline-level elements accept inline-block;
// block-level elements need to be inline with layout
Expand Down Expand Up @@ -274,6 +274,27 @@ jQuery.fn.extend({

});

// Animations created synchronously will run synchronously
function createFxNow() {
setTimeout( clearFxNow, 0 );
return ( fxNow = jQuery.now() );
}

function clearFxNow() {
fxNow = undefined;
}

// Generate parameters to create a standard animation
function genFx( type, num ) {
var obj = {};

jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
obj[ this ] = type;
});

return obj;
}

// Generate shortcuts for custom animations
jQuery.each({
slideDown: genFx("show", 1),
Expand Down Expand Up @@ -589,25 +610,4 @@ function defaultDisplay( nodeName ) {
return elemdisplay[ nodeName ];
}

// Animations created synchronously will run synchronously
function createFxNow() {
setTimeout( clearFxNow, 0 );
return ( fxNow = jQuery.now() );
}

function clearFxNow() {
fxNow = undefined;
}

// Generate parameters to create a standard animation
function genFx( type, num ) {
var obj = {};

jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {
obj[ this ] = type;
});

return obj;
}

})( jQuery );
2 changes: 1 addition & 1 deletion src/sizzle
Submodule sizzle updated 2 files
+2 −2 test/index.html
+39 −39 test/unit/selector.js
6 changes: 3 additions & 3 deletions test/index.html
Expand Up @@ -58,10 +58,10 @@ <h2 id="qunit-userAgent"></h2>
<div id="nothiddendiv" style="height:1px;background:white;" class="nothiddendiv">
<div id="nothiddendivchild"></div>
</div>
<!-- this iframe is outside the #main so it won't reload constantly wasting time, but it means the tests must be "safe" and clean up after themselves -->
<!-- this iframe is outside the #qunit-fixture so it won't reload constantly wasting time, but it means the tests must be "safe" and clean up after themselves -->
<iframe id="loadediframe" name="loadediframe" style="display:none;" src="data/iframe.html"></iframe>
<dl id="dl" style="position:absolute;top:-32767px;left:-32767px;">
<div id="main">
<dl id="dl" style="position:absolute;top:-32767px;left:-32767px;width:1px">
<div id="qunit-fixture">
<p id="firstp">See <a id="simon1" href="http://simon.incutio.com/archive/2003/03/25/#getElementsBySelector" rel="bookmark">this blog entry</a> for more information.</p>
<p id="ap">
Here are some links in a normal paragraph: <a id="google" href="http://www.google.com/" title="Google!">Google</a>,
Expand Down
2 changes: 1 addition & 1 deletion test/qunit
Submodule qunit updated from d404fa to 69925b
4 changes: 2 additions & 2 deletions test/unit/ajax.js
Expand Up @@ -1782,7 +1782,7 @@ test("jQuery.ajaxSetup({timeout: Number}) - with global timeout", function() {
passed++;
if ( passed == 2 ) {
ok( true, "Check local and global callbacks after timeout" );
jQuery("#main").unbind("ajaxError");
jQuery("#qunit-fixture").unbind("ajaxError");
start();
}
};
Expand All @@ -1792,7 +1792,7 @@ test("jQuery.ajaxSetup({timeout: Number}) - with global timeout", function() {
start();
};

jQuery("#main").ajaxError(pass);
jQuery("#qunit-fixture").ajaxError(pass);

jQuery.ajax({
type: "GET",
Expand Down
4 changes: 2 additions & 2 deletions test/unit/attributes.js
Expand Up @@ -108,7 +108,7 @@ test("attr(String)", function() {
equals( jQuery("#area1").attr("maxLength"), "30", "Check for maxLength attribute" );

// using innerHTML in IE causes href attribute to be serialized to the full path
jQuery("<a/>").attr({ "id": "tAnchor5", "href": "#5" }).appendTo("#main");
jQuery("<a/>").attr({ "id": "tAnchor5", "href": "#5" }).appendTo("#qunit-fixture");
equals( jQuery("#tAnchor5").attr("href"), "#5", "Check for non-absolute href (an anchor)" );

// list attribute is readonly by default in browsers that support it
Expand Down Expand Up @@ -599,7 +599,7 @@ test("val(Function) with incoming value", function() {
test("val(select) after form.reset() (Bug #2551)", function() {
expect(3);

jQuery("<form id='kk' name='kk'><select id='kkk'><option value='cf'>cf</option><option value='gf'>gf</option></select></form>").appendTo("#main");
jQuery("<form id='kk' name='kk'><select id='kkk'><option value='cf'>cf</option><option value='gf'>gf</option></select></form>").appendTo("#qunit-fixture");

jQuery("#kkk").val( "gf" );

Expand Down
78 changes: 39 additions & 39 deletions test/unit/core.js
Expand Up @@ -29,7 +29,7 @@ test("jQuery()", function() {
equals( jQuery(window).length, 1, "Correct number of elements generated for jQuery(window)" );


var main = jQuery("#main");
var main = jQuery("#qunit-fixture");
same( jQuery("div p", main).get(), q("sndp", "en", "sap"), "Basic selector with jQuery object as context" );

/*
Expand Down Expand Up @@ -115,54 +115,54 @@ test("selector state", function() {
equals( test.selector, "", "Body Selector" );
equals( test.context, document.body, "Body Context" );

test = jQuery("#main");
equals( test.selector, "#main", "#main Selector" );
equals( test.context, document, "#main Context" );
test = jQuery("#qunit-fixture");
equals( test.selector, "#qunit-fixture", "#qunit-fixture Selector" );
equals( test.context, document, "#qunit-fixture Context" );

test = jQuery("#notfoundnono");
equals( test.selector, "#notfoundnono", "#notfoundnono Selector" );
equals( test.context, document, "#notfoundnono Context" );

test = jQuery("#main", document);
equals( test.selector, "#main", "#main Selector" );
equals( test.context, document, "#main Context" );
test = jQuery("#qunit-fixture", document);
equals( test.selector, "#qunit-fixture", "#qunit-fixture Selector" );
equals( test.context, document, "#qunit-fixture Context" );

test = jQuery("#main", document.body);
equals( test.selector, "#main", "#main Selector" );
equals( test.context, document.body, "#main Context" );
test = jQuery("#qunit-fixture", document.body);
equals( test.selector, "#qunit-fixture", "#qunit-fixture Selector" );
equals( test.context, document.body, "#qunit-fixture Context" );

// Test cloning
test = jQuery(test);
equals( test.selector, "#main", "#main Selector" );
equals( test.context, document.body, "#main Context" );
equals( test.selector, "#qunit-fixture", "#qunit-fixture Selector" );
equals( test.context, document.body, "#qunit-fixture Context" );

test = jQuery(document.body).find("#main");
equals( test.selector, "#main", "#main find Selector" );
equals( test.context, document.body, "#main find Context" );
test = jQuery(document.body).find("#qunit-fixture");
equals( test.selector, "#qunit-fixture", "#qunit-fixture find Selector" );
equals( test.context, document.body, "#qunit-fixture find Context" );

test = jQuery("#main").filter("div");
equals( test.selector, "#main.filter(div)", "#main filter Selector" );
equals( test.context, document, "#main filter Context" );
test = jQuery("#qunit-fixture").filter("div");
equals( test.selector, "#qunit-fixture.filter(div)", "#qunit-fixture filter Selector" );
equals( test.context, document, "#qunit-fixture filter Context" );

test = jQuery("#main").not("div");
equals( test.selector, "#main.not(div)", "#main not Selector" );
equals( test.context, document, "#main not Context" );
test = jQuery("#qunit-fixture").not("div");
equals( test.selector, "#qunit-fixture.not(div)", "#qunit-fixture not Selector" );
equals( test.context, document, "#qunit-fixture not Context" );

test = jQuery("#main").filter("div").not("div");
equals( test.selector, "#main.filter(div).not(div)", "#main filter, not Selector" );
equals( test.context, document, "#main filter, not Context" );
test = jQuery("#qunit-fixture").filter("div").not("div");
equals( test.selector, "#qunit-fixture.filter(div).not(div)", "#qunit-fixture filter, not Selector" );
equals( test.context, document, "#qunit-fixture filter, not Context" );

test = jQuery("#main").filter("div").not("div").end();
equals( test.selector, "#main.filter(div)", "#main filter, not, end Selector" );
equals( test.context, document, "#main filter, not, end Context" );
test = jQuery("#qunit-fixture").filter("div").not("div").end();
equals( test.selector, "#qunit-fixture.filter(div)", "#qunit-fixture filter, not, end Selector" );
equals( test.context, document, "#qunit-fixture filter, not, end Context" );

test = jQuery("#main").parent("body");
equals( test.selector, "#main.parent(body)", "#main parent Selector" );
equals( test.context, document, "#main parent Context" );
test = jQuery("#qunit-fixture").parent("body");
equals( test.selector, "#qunit-fixture.parent(body)", "#qunit-fixture parent Selector" );
equals( test.context, document, "#qunit-fixture parent Context" );

test = jQuery("#main").eq(0);
equals( test.selector, "#main.slice(0,1)", "#main eq Selector" );
equals( test.context, document, "#main eq Context" );
test = jQuery("#qunit-fixture").eq(0);
equals( test.selector, "#qunit-fixture.slice(0,1)", "#qunit-fixture eq Selector" );
equals( test.context, document, "#qunit-fixture eq Context" );

var d = "<div />";
equals(
Expand Down Expand Up @@ -228,7 +228,7 @@ test("noConflict", function() {
equals( jQuery.noConflict(true), $$, "noConflict returned the jQuery object" );
equals( jQuery, originaljQuery, "Make sure jQuery was reverted." );
equals( $, original$, "Make sure $ was reverted." );
ok( $$("#main").html("test"), "Make sure that jQuery still works." );
ok( $$("#qunit-fixture").html("test"), "Make sure that jQuery still works." );

jQuery = $$;
});
Expand Down Expand Up @@ -571,29 +571,29 @@ test("end()", function() {

test("length", function() {
expect(1);
equals( jQuery("#main p").length, 6, "Get Number of Elements Found" );
equals( jQuery("#qunit-fixture p").length, 6, "Get Number of Elements Found" );
});

test("size()", function() {
expect(1);
equals( jQuery("#main p").size(), 6, "Get Number of Elements Found" );
equals( jQuery("#qunit-fixture p").size(), 6, "Get Number of Elements Found" );
});

test("get()", function() {
expect(1);
same( jQuery("#main p").get(), q("firstp","ap","sndp","en","sap","first"), "Get All Elements" );
same( jQuery("#qunit-fixture p").get(), q("firstp","ap","sndp","en","sap","first"), "Get All Elements" );
});

test("toArray()", function() {
expect(1);
same( jQuery("#main p").toArray(),
same( jQuery("#qunit-fixture p").toArray(),
q("firstp","ap","sndp","en","sap","first"),
"Convert jQuery object to an Array" )
})

test("get(Number)", function() {
expect(2);
equals( jQuery("#main p").get(0), document.getElementById("firstp"), "Get A Single Element" );
equals( jQuery("#qunit-fixture p").get(0), document.getElementById("firstp"), "Get A Single Element" );
strictEqual( jQuery("#firstp").get(1), undefined, "Try get with index larger elements count" );
});

Expand Down
2 changes: 1 addition & 1 deletion test/unit/css.js
Expand Up @@ -3,7 +3,7 @@ module("css", { teardown: moduleTeardown });
test("css(String|Hash)", function() {
expect( 42 );

equals( jQuery("#main").css("display"), "block", "Check for css property \"display\"");
equals( jQuery("#qunit-fixture").css("display"), "block", "Check for css property \"display\"");

ok( jQuery("#nothiddendiv").is(":visible"), "Modifying CSS display: Assert element is visible");
jQuery("#nothiddendiv").css({display: "none"});
Expand Down
4 changes: 2 additions & 2 deletions test/unit/data.js
Expand Up @@ -316,7 +316,7 @@ test("data-* attributes", function() {

div.remove();

child.appendTo("#main");
child.appendTo("#qunit-fixture");
equals( child.data("myobj"), "old data", "Value accessed from data-* attribute");

child.data("myobj", "replaced");
Expand Down Expand Up @@ -406,7 +406,7 @@ test("data-* attributes", function() {
}

var metadata = "<ol><li class='test test2' data-foo='bar' data-bar='baz' data-arr='[1,2]'>Some stuff</li><li class='test test2' data-test='bar' data-bar='baz'>Some stuff</li><li class='test test2' data-zoooo='bar' data-bar='{\"test\":\"baz\"}'>Some stuff</li><li class='test test2' data-number=true data-stuff='[2,8]'>Some stuff</li></ol>",
elem = jQuery(metadata).appendTo("#main");
elem = jQuery(metadata).appendTo("#qunit-fixture");

elem.find("li").each(testData);
elem.remove();
Expand Down
20 changes: 10 additions & 10 deletions test/unit/effects.js
Expand Up @@ -2,7 +2,7 @@ module("effects", { teardown: moduleTeardown });

test("sanity check", function() {
expect(1);
ok( jQuery("#dl:visible, #main:visible, #foo:visible").length === 3, "QUnit state is correct for testing effects" );
ok( jQuery("#dl:visible, #qunit-fixture:visible, #foo:visible").length === 3, "QUnit state is correct for testing effects" );
});

test("show()", function() {
Expand All @@ -14,7 +14,7 @@ test("show()", function() {

equals( hiddendiv.css("display"), "block", "Make sure a pre-hidden div is visible." );

var div = jQuery("<div>").hide().appendTo("#main").show();
var div = jQuery("<div>").hide().appendTo("#qunit-fixture").show();

equal( div.css("display"), "block", "Make sure pre-hidden divs show" );

Expand All @@ -32,7 +32,7 @@ test("show()", function() {

hiddendiv.css("display","");

var pass = true, div = jQuery("#main div");
var pass = true, div = jQuery("#qunit-fixture div");
div.show().each(function(){
if ( this.style.display == "none" ) pass = false;
});
Expand Down Expand Up @@ -62,7 +62,7 @@ test("show()", function() {
});

// #show-tests * is set display: none in CSS
jQuery("#main").append("<div id='show-tests'><div><p><a href='#'></a></p><code></code><pre></pre><span></span></div><table><thead><tr><th></th></tr></thead><tbody><tr><td></td></tr></tbody></table><ul><li></li></ul></div><table id='test-table'></table>");
jQuery("#qunit-fixture").append("<div id='show-tests'><div><p><a href='#'></a></p><code></code><pre></pre><span></span></div><table><thead><tr><th></th></tr></thead><tbody><tr><td></td></tr></tbody></table><ul><li></li></ul></div><table id='test-table'></table>");

var old = jQuery("#test-table").show().css("display") !== "table";
jQuery("#test-table").remove();
Expand Down Expand Up @@ -100,7 +100,7 @@ test("show(Number) - other displays", function() {
stop();

// #show-tests * is set display: none in CSS
jQuery("#main").append("<div id='show-tests'><div><p><a href='#'></a></p><code></code><pre></pre><span></span></div><table><thead><tr><th></th></tr></thead><tbody><tr><td></td></tr></tbody></table><ul><li></li></ul></div><table id='test-table'></table>");
jQuery("#qunit-fixture").append("<div id='show-tests'><div><p><a href='#'></a></p><code></code><pre></pre><span></span></div><table><thead><tr><th></th></tr></thead><tbody><tr><td></td></tr></tbody></table><ul><li></li></ul></div><table id='test-table'></table>");

var old = jQuery("#test-table").show().css("display") !== "table",
num = 0;
Expand Down Expand Up @@ -142,7 +142,7 @@ test("Persist correct display value", function() {
stop();

// #show-tests * is set display: none in CSS
jQuery("#main").append("<div id='show-tests'><span style='position:absolute;'>foo</span></div>");
jQuery("#qunit-fixture").append("<div id='show-tests'><span style='position:absolute;'>foo</span></div>");

var $span = jQuery("#show-tests span"),
displayNone = $span.css("display"),
Expand Down Expand Up @@ -585,7 +585,7 @@ jQuery.checkOverflowDisplay = function(){
}

test( "jQuery.fx.prototype.cur()", 6, function() {
var div = jQuery( "<div></div>" ).appendTo( "#main" ).css({
var div = jQuery( "<div></div>" ).appendTo( "#qunit-fixture" ).css({
color: "#ABC",
border: "5px solid black",
left: "auto",
Expand Down Expand Up @@ -958,7 +958,7 @@ test("hide hidden elements (bug #7141)", function() {
expect(3);
QUnit.reset();

var div = jQuery("<div style='display:none'></div>").appendTo("#main");
var div = jQuery("<div style='display:none'></div>").appendTo("#qunit-fixture");
equals( div.css("display"), "none", "Element is hidden by default" );
div.hide();
ok( !jQuery._data(div, "olddisplay"), "olddisplay is undefined after hiding an already-hidden element" );
Expand All @@ -973,7 +973,7 @@ test("hide hidden elements, with animation (bug #7141)", function() {
QUnit.reset();
stop();

var div = jQuery("<div style='display:none'></div>").appendTo("#main");
var div = jQuery("<div style='display:none'></div>").appendTo("#qunit-fixture");
equals( div.css("display"), "none", "Element is hidden by default" );
div.hide(1, function () {
ok( !jQuery._data(div, "olddisplay"), "olddisplay is undefined after hiding an already-hidden element" );
Expand All @@ -986,7 +986,7 @@ test("hide hidden elements, with animation (bug #7141)", function() {

test("animate unit-less properties (#4966)", 2, function() {
stop();
var div = jQuery( "<div style='z-index: 0; position: absolute;'></div>" ).appendTo( "#main" );
var div = jQuery( "<div style='z-index: 0; position: absolute;'></div>" ).appendTo( "#qunit-fixture" );
equal( div.css( "z-index" ), "0", "z-index is 0" );
div.animate({ zIndex: 2 }, function() {
equal( div.css( "z-index" ), "2", "z-index is 2" );
Expand Down

0 comments on commit 7a8fac5

Please sign in to comment.