Merge branch 'master' of github.com:jquery/jquery into 1.7/callbacks

Conflicts:
	src/deferred.js
This commit is contained in:
jaubourg 2011-05-09 10:19:12 +02:00
commit d65b27810b
4 changed files with 47 additions and 5 deletions

View file

@ -50,7 +50,7 @@ jQuery.extend({
if ( jQuery.isFunction( fn ) ) {
deferred[ handler ](function() {
returned = fn.apply( this, arguments );
if ( jQuery.isFunction( returned.promise ) ) {
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.ping );
} else {
newDefer[ action ]( returned );

View file

@ -3,6 +3,7 @@
jQuery.support = (function() {
var div = document.createElement( "div" ),
documentElement = document.documentElement,
all,
a,
select,
@ -150,7 +151,7 @@ jQuery.support = (function() {
body.style[ i ] = bodyStyle[ i ];
}
body.appendChild( div );
document.documentElement.appendChild( body );
documentElement.insertBefore( body, documentElement.firstChild );
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
@ -210,7 +211,7 @@ jQuery.support = (function() {
// Remove the body element we added
body.innerHTML = "";
document.documentElement.removeChild( body );
documentElement.removeChild( body );
// Technique from Juriy Zaytsev
// http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/

33
test/boxModelIE.html Normal file
View file

@ -0,0 +1,33 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<h3>jQuery Test boxModel detection in IE 6 & 7 compatMode="CSS1Compat"</h3>
<div>document.compatMode = <span id="compat-mode">?</span></div>
<div>jQuery.support.boxModel = <span id="box-model">?</span></div>
<script src="../src/core.js"></script>
<script src="../src/deferred.js"></script>
<script src="../src/support.js"></script>
<script src="../src/data.js"></script>
<script src="../src/queue.js"></script>
<script src="../src/attributes.js"></script>
<script src="../src/event.js"></script>
<script src="../src/sizzle/sizzle.js"></script>
<script src="../src/sizzle-jquery.js"></script>
<script src="../src/traversing.js"></script>
<script src="../src/manipulation.js"></script>
<script src="../src/css.js"></script>
<script src="../src/ajax.js"></script>
<script src="../src/ajax/jsonp.js"></script>
<script src="../src/ajax/script.js"></script>
<script src="../src/ajax/xhr.js"></script>
<script src="../src/effects.js"></script>
<script src="../src/offset.js"></script>
<script src="../src/dimensions.js"></script>
<script>
jQuery(function() {
jQuery( "#compat-mode" ).text( document.compatMode );
jQuery( "#box-model" ).text( jQuery.support.boxModel );
});
</script>
</body>
</html>

View file

@ -53,7 +53,7 @@ jQuery.each( [ "", " - new operator" ], function( _, withNew ) {
test( "jQuery.Deferred.pipe - filtering (done)", function() {
expect(3);
expect(4);
var defer = jQuery.Deferred(),
piped = defer.pipe(function( a, b ) {
@ -81,11 +81,15 @@ test( "jQuery.Deferred.pipe - filtering (done)", function() {
jQuery.Deferred().reject().pipe(function() {
ok( false, "pipe should not be called on reject" );
});
jQuery.Deferred().resolve().pipe( jQuery.noop ).done(function( value ) {
strictEqual( value, undefined, "pipe done callback can return undefined/null" );
});
});
test( "jQuery.Deferred.pipe - filtering (fail)", function() {
expect(3);
expect(4);
var defer = jQuery.Deferred(),
piped = defer.pipe( null, function( a, b ) {
@ -113,6 +117,10 @@ test( "jQuery.Deferred.pipe - filtering (fail)", function() {
jQuery.Deferred().resolve().pipe( null, function() {
ok( false, "pipe should not be called on resolve" );
} );
jQuery.Deferred().reject().pipe( null, jQuery.noop ).fail(function( value ) {
strictEqual( value, undefined, "pipe fail callback can return undefined/null" );
});
});
test( "jQuery.Deferred.pipe - filtering (progress)", function() {