Bug Tracker

Opened 9 years ago

Closed 9 years ago

#14824 closed bug (fixed)

jQuery v1.11 and v2.1 slideUp and slideDown not respecting css display property on non-block elements

Reported by: [email protected] Owned by:
Priority: high Milestone: 1.11.1/2.1.1
Component: effects Version: 1.11.0
Keywords: Cc:
Blocked by: Blocking:


I noticed that after upgrading from jQuery version 1.9 to version 1.11 that the behavior of methods like slideUp, slideDown, and slideToggle has changed when applied to non-block elements (i.e., span) which have a css display value specified. In the previous versions, such as v1.9, the display value would get set (after its animation had completed) to whatever we specifed in our CSS definition. In version 1.11 and 2.1, the display value is not respected in this way (at least not for non-block elements).

Is this a new bug in jQuery 1.11 and 2.1? I saw that in older versions of jQuery, other people reported similar problems, such as this and this. Those problems seem to have been reported as fixed, and in our experience with jQuery 1.9, that seemed to be the case. But it seems like its broken again in 1.11 and 2.1. Here is a simple reproducible example:


    <span class="b">block</span> <!-- notice this is not a block-level element... -->
    <a href="#" class="toggle">toggle it</a>


    .b {
        display:block; /* ... but I need it to display like a block-level element */


    var isExpanded = true;

    $(".toggle").bind("click", function(){
        if(isExpanded) {   
            isExpanded = false;
        else {
            isExpanded = true;

See it working in this jsFiddle example, which uses jQuery 1.9. This produces the expected result when toggled open:


Unfortunately, jQuery version 1.11 (or 2.1) is not respecting our display value, instead setting it to inline-block:


This can be seen in this jsFiddle example, where the only thing changed is the jQuery version.

Did I miss a statement from jQuery telling us that this behavior would be different in this new version? These release notes didn't seem to say anything as such, indicating that with this upgrade... "Your code shouldn’t break, it should just run a little faster." But I may have missed a statement somewhere.

Thank you for your help.

Note: I realize that changing the span in this contrived example to a div may solve this problem, but there are times when we need to use a span that is given block-level style (i.e., you can't nest a div inside of a span), and we have a large production application with many such cases.

Change History (3)

comment:1 Changed 9 years ago by Curtis

Is there any update regarding this issue?

comment:2 Changed 9 years ago by dmethvin

Component: unfiledeffects
Milestone: None1.11.1/2.1.1
Priority: undecidedhigh
Status: newopen

Yes, confirmed.

comment:3 Changed 9 years ago by Oleg Gaidarenko

Resolution: fixed
Status: openclosed

Effects: Respect display value on inline elements

Take "olddisplay" value into the account

Fixes #14824 Closes gh-1566 Ref 73fe17299a840a8a7f3ffffcac15e32a88bd3d66

Changeset: c34dbf5a8d135e0f873ab7a76d1c8f8e316f31e4

Note: See TracTickets for help on using tickets.