]> source.dussan.org Git - jquery.git/commitdiff
Remove inlineBlockNeedsLayout and shrinkWrapBlocks.
authorDave Methvin <dave.methvin@gmail.com>
Thu, 3 Jan 2013 01:45:45 +0000 (20:45 -0500)
committerDave Methvin <dave.methvin@gmail.com>
Fri, 4 Jan 2013 01:52:38 +0000 (20:52 -0500)
src/effects.js
src/support.js
test/unit/effects.js

index 3d9ae7f4ba5f099e63e0bc5bf78f7715af494ae6..f4f435fd22760b378e4949ae1659fe9dc8c741c2 100644 (file)
@@ -282,26 +282,17 @@ function defaultPrefilter( elem, props, opts ) {
                if ( jQuery.css( elem, "display" ) === "inline" &&
                                jQuery.css( elem, "float" ) === "none" ) {
 
-                       // inline-level elements accept inline-block;
-                       // block-level elements need to be inline with layout
-                       if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
-                               style.display = "inline-block";
-
-                       } else {
-                               style.zoom = 1;
-                       }
+                       style.display = "inline-block";
                }
        }
 
        if ( opts.overflow ) {
                style.overflow = "hidden";
-               if ( !jQuery.support.shrinkWrapBlocks ) {
-                       anim.done(function() {
-                               style.overflow = opts.overflow[ 0 ];
-                               style.overflowX = opts.overflow[ 1 ];
-                               style.overflowY = opts.overflow[ 2 ];
-                       });
-               }
+               anim.done(function() {
+                       style.overflow = opts.overflow[ 0 ];
+                       style.overflowX = opts.overflow[ 1 ];
+                       style.overflowY = opts.overflow[ 2 ];
+               });
        }
 
 
index 35bf0e6f3f7ed4e747b986aa0a27bf71ab2c4e79..114c1c31b5464a69e77134d4153728ed3d666aa0 100644 (file)
@@ -38,8 +38,6 @@ jQuery.support = (function() {
                // Will be defined later
                deleteExpando: true,
                noCloneEvent: true,
-               inlineBlockNeedsLayout: false,
-               shrinkWrapBlocks: false,
                reliableMarginRight: true,
                boxSizingReliable: true,
                pixelPosition: false
@@ -139,27 +137,6 @@ jQuery.support = (function() {
                                !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
                }
 
-               if ( typeof div.style.zoom !== "undefined" ) {
-                       // Support: IE<8
-                       // Check if natively block-level elements act like inline-block
-                       // elements when setting their display to 'inline' and giving
-                       // them layout
-                       div.innerHTML = "";
-                       div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
-                       support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
-
-                       // Support: IE6
-                       // Check if elements with layout shrink-wrap their children
-                       div.style.display = "block";
-                       div.innerHTML = "<div></div>";
-                       div.firstChild.style.width = "5px";
-                       support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
-
-                       // Prevent IE 6 from affecting layout for positioned elements #11048
-                       // Prevent IE from shrinking the body in IE 7 mode #12869
-                       body.style.zoom = 1;
-               }
-
                body.removeChild( container );
 
                // Null elements to avoid leaks in IE
index b615dfd6dfb412756a9cb42b0f1c6542c566e295..5ab1d2ac8dcef8ed46b5114d598eb9e8b28037f5 100644 (file)
@@ -232,55 +232,29 @@ test("animate negative padding", function() {
 test("animate block as inline width/height", function() {
        expect(3);
 
-       var span = jQuery("<span>").css("display", "inline-block").appendTo("body"),
-               expected = span.css("display");
-
-       span.remove();
-
-       if ( jQuery.support.inlineBlockNeedsLayout || expected === "inline-block" ) {
-               stop();
-
-               jQuery("#foo").css({ display: "inline", width: "", height: "" }).animate({ width: 42, height: 42 }, 100, function() {
-                       equal( jQuery(this).css("display"), jQuery.support.inlineBlockNeedsLayout ? "inline" : "inline-block", "inline-block was set on non-floated inline element when animating width/height" );
-                       equal( this.offsetWidth, 42, "width was animated" );
-                       equal( this.offsetHeight, 42, "height was animated" );
-                       start();
-               });
+       stop();
 
-       // Browser doesn't support inline-block
-       } else {
-               ok( true, "Browser doesn't support inline-block" );
-               ok( true, "Browser doesn't support inline-block" );
-               ok( true, "Browser doesn't support inline-block" );
-       }
+       jQuery("#foo").css({ display: "inline", width: "", height: "" }).animate({ width: 42, height: 42 }, 100, function() {
+               equal( jQuery(this).css("display"), "inline-block", "inline-block was set on non-floated inline element when animating width/height" );
+               equal( this.offsetWidth, 42, "width was animated" );
+               equal( this.offsetHeight, 42, "height was animated" );
+               start();
+       });
 });
 
 test("animate native inline width/height", function() {
        expect(3);
 
-       var span = jQuery("<span>").css("display", "inline-block").appendTo("body"),
-               expected = span.css("display");
-
-       span.remove();
-
-       if ( jQuery.support.inlineBlockNeedsLayout || expected === "inline-block" ) {
-               stop();
-               jQuery("#foo").css({ display: "", width: "", height: "" })
-                       .append("<span>text</span>")
-                       .children("span")
-                               .animate({ width: 42, height: 42 }, 100, function() {
-                                       equal( jQuery(this).css("display"), "inline-block", "inline-block was set on non-floated inline element when animating width/height" );
-                                       equal( this.offsetWidth, 42, "width was animated" );
-                                       equal( this.offsetHeight, 42, "height was animated" );
-                                       start();
-                               });
-
-       // Browser doesn't support inline-block
-       } else {
-               ok( true, "Browser doesn't support inline-block" );
-               ok( true, "Browser doesn't support inline-block" );
-               ok( true, "Browser doesn't support inline-block" );
-       }
+       stop();
+       jQuery("#foo").css({ display: "", width: "", height: "" })
+               .append("<span>text</span>")
+               .children("span")
+                       .animate({ width: 42, height: 42 }, 100, function() {
+                               equal( jQuery(this).css("display"), "inline-block", "inline-block was set on non-floated inline element when animating width/height" );
+                               equal( this.offsetWidth, 42, "width was animated" );
+                               equal( this.offsetHeight, 42, "height was animated" );
+                               start();
+                       });
 });
 
 test("animate block width/height", function() {
@@ -999,11 +973,10 @@ jQuery.each({
 
 asyncTest("Effects chaining", function() {
        var remaining = 16,
-               shrinkwrap = jQuery.support.shrinkWrapBlocks,
                props = [ "opacity", "height", "width", "display", "overflow" ],
-               setup = function( name, selector, hiddenOverflow ) {
+               setup = function( name, selector ) {
                        var $el = jQuery( selector );
-                       return $el.data( getProps( $el[0], hiddenOverflow ) ).data( "name", name );
+                       return $el.data( getProps( $el[0] ) ).data( "name", name );
                },
                assert = function() {
                        var data = jQuery.data( this ),
@@ -1017,31 +990,29 @@ asyncTest("Effects chaining", function() {
                                start();
                        }
                },
-               getProps = function( el, hiddenOverflow ) {
+               getProps = function( el ) {
                        var obj = {};
                        jQuery.each( props, function( i, prop ) {
-                               obj[ prop ] = prop === "overflow" && hiddenOverflow ? "hidden" : el.style[ prop ] || jQuery.css( el, prop );
+                               obj[ prop ] = prop === "overflow" && el.style[ prop ] || jQuery.css( el, prop );
                        });
                        return obj;
                };
 
        expect( remaining );
 
-       // We need to pass jQuery.support.shrinkWrapBlocks for all methods that
-       // set overflow hidden (slide* and show/hide with speed)
        setup( ".fadeOut().fadeIn()", "#fadein div" ).fadeOut("fast").fadeIn( "fast", assert );
        setup( ".fadeIn().fadeOut()", "#fadeout div" ).fadeIn("fast").fadeOut( "fast", assert );
-       setup( ".hide().show()", "#show div",  shrinkwrap ).hide("fast").show( "fast", assert );
-       setup( ".show().hide()", "#hide div",  shrinkwrap ).show("fast").hide( "fast", assert );
-       setup( ".show().hide(easing)", "#easehide div", shrinkwrap ).show("fast").hide( "fast", "linear", assert );
-       setup( ".toggle().toggle() - in", "#togglein div", shrinkwrap ).toggle("fast").toggle( "fast", assert );
-       setup( ".toggle().toggle() - out", "#toggleout div", shrinkwrap ).toggle("fast").toggle( "fast", assert );
-       setup( ".toggle().toggle(easing) - out", "#easetoggleout div", shrinkwrap ).toggle("fast").toggle( "fast", "linear", assert );
-       setup( ".slideDown().slideUp()", "#slidedown div", shrinkwrap ).slideDown("fast").slideUp( "fast", assert );
-       setup( ".slideUp().slideDown()", "#slideup div", shrinkwrap ).slideUp("fast").slideDown( "fast", assert );
-       setup( ".slideUp().slideDown(easing)", "#easeslideup div", shrinkwrap ).slideUp("fast").slideDown( "fast", "linear", assert );
-       setup( ".slideToggle().slideToggle() - in", "#slidetogglein div", shrinkwrap ).slideToggle("fast").slideToggle( "fast", assert );
-       setup( ".slideToggle().slideToggle() - out", "#slidetoggleout div", shrinkwrap ).slideToggle("fast").slideToggle( "fast", assert );
+       setup( ".hide().show()", "#show div" ).hide("fast").show( "fast", assert );
+       setup( ".show().hide()", "#hide div" ).show("fast").hide( "fast", assert );
+       setup( ".show().hide(easing)", "#easehide div" ).show("fast").hide( "fast", "linear", assert );
+       setup( ".toggle().toggle() - in", "#togglein div" ).toggle("fast").toggle( "fast", assert );
+       setup( ".toggle().toggle() - out", "#toggleout div" ).toggle("fast").toggle( "fast", assert );
+       setup( ".toggle().toggle(easing) - out", "#easetoggleout div" ).toggle("fast").toggle( "fast", "linear", assert );
+       setup( ".slideDown().slideUp()", "#slidedown div" ).slideDown("fast").slideUp( "fast", assert );
+       setup( ".slideUp().slideDown()", "#slideup div" ).slideUp("fast").slideDown( "fast", assert );
+       setup( ".slideUp().slideDown(easing)", "#easeslideup div" ).slideUp("fast").slideDown( "fast", "linear", assert );
+       setup( ".slideToggle().slideToggle() - in", "#slidetogglein div" ).slideToggle("fast").slideToggle( "fast", assert );
+       setup( ".slideToggle().slideToggle() - out", "#slidetoggleout div" ).slideToggle("fast").slideToggle( "fast", assert );
        setup( ".fadeToggle().fadeToggle() - in", "#fadetogglein div" ).fadeToggle("fast").fadeToggle( "fast", assert );
        setup( ".fadeToggle().fadeToggle() - out", "#fadetoggleout div" ).fadeToggle("fast").fadeToggle( "fast", assert );
        setup( ".fadeTo(0.5).fadeTo(1.0, easing)", "#fadeto div" ).fadeTo( "fast", 0.5 ).fadeTo( "fast", 1.0, "linear", assert );