Skip to main content

Bug Tracker

Side navigation

#2185 closed bug (fixed)

Opened January 17, 2008 04:54PM UTC

Closed October 09, 2010 08:22PM UTC

Last modified March 14, 2012 07:06AM UTC

animate does not work properly with non-block-level elements (table, tr, td, inline, etc.)

Reported by: Johnath Owned by: snover
Priority: high Milestone: 1.4.3
Component: effects Version: 1.4.2
Keywords: Cc: snover
Blocked by: Blocking:
Description

Using slideToggle to hide/show a div styled with

display: inline-block;

Causes the display to go to "none" when hidden, and then "block" when restored. Ideally, the display should be set back to its original value.

It's simple to workaround by wrapping the styled div(s) in a normal block div, but obviously that's suboptimal. Obviously, testing this requires a browser that understands inline-block. I am seeing this behaviour in the Firefox 3 betas.

Attachments (0)
Change History (13)

Changed January 20, 2008 06:55AM UTC by michaeltsmit comment:1

Just to clarify, this bug is also reproducible with slideUp and slideDown. show() & hide() don't reproduce the error. Further, this error also occurs for items with displays other than display: inline... table rows go from display: table-row to display: none (on hide) to display: block (on show again). Seems the patch would be either be for an option to add the display parameter or for jQuery to somehow remember the proper display type.

Changed January 28, 2008 09:01PM UTC by josephtate comment:2

I can confirm the same behavior that michaeltsmith85 is seeing. An inline css style of "display:none" set for a <tr> is being set with slideToggle to "display:block" which borks the table. It should be set to "table-row". I would opt for/maybe prefer setting the display parameter myself as it seems it could be complicated for jQuery to determine what sort of element needs what sort of display type.

Changed February 18, 2009 03:40AM UTC by dmethvin comment:3

Duplicate bugs #2503 and #4096 have more discussion.

Changed March 11, 2009 03:17AM UTC by dotnetCarpenter comment:4

Seems that there is two issues here.

  • 1) height and width animations are always set to display: block
  • 2) not all animations revert display back to the original

In jQuery.fx.update we need to check for inline-block or table-row.

// Set display property to block for height/width animations
if ( ( this.prop == "height" || this.prop == "width" ) && this.elem.style )
  this.elem.style.display = "block";

''line 4022-4024 in jQuery 1.3.2''

The second issue is solved in jQuery.fx.animate.

if ( ( p == "height" || p == "width" ) && this.style ) {
  // Store display property
  opt.display = jQuery.css(this, "display");

''line 3878-3880 in jQuery 1.3.2''

Changed March 13, 2009 01:25AM UTC by dotnetCarpenter comment:5

Changed November 14, 2009 03:27AM UTC by dmethvin comment:6

Closed dups #4458 and #5487 .

Changed December 01, 2009 10:59PM UTC by yehuda comment:7

resolution: → worksforme
status: newclosed

This was fixed a while back and there are tests for it.

Changed September 07, 2010 03:12PM UTC by esteluk comment:8

resolution: worksforme
status: closedreopened

Is this genuinely fixed? My test case at http://estel.uwcs.co.uk/jquery/inlineblock.html still shows this issue to persist, and it's fixed by an amalgamation of fixes in this and #2503.

Changed October 04, 2010 09:34PM UTC by snover comment:9

cc: → snover
milestone: 1.2.31.4.3
need: ReviewPatch
owner: → snover
priority: minorhigh
status: reopenednew
version: 1.2.21.4.2

No, this is not fixed. I have a patch that I am going to try to get landed for 1.4.3 or 1.next.

Bugs #7110, #6999, #6791, #6736, #6311, #6036, #5372, #5194, #5157, #5047, #4535, and #2580 are duplicates of this bug.

Changed October 04, 2010 09:35PM UTC by snover comment:10

status: newassigned
summary: slideToggle doesn't preserve "display" styleanimate does not work properly with non-block-level elements (table, tr, td, inline, etc.)

Changed October 05, 2010 08:29PM UTC by snover comment:11

need: PatchCommit

Changed October 09, 2010 08:22PM UTC by john comment:12

resolution: → fixed
status: assignedclosed

Changed October 31, 2010 09:41PM UTC by snover comment:13

#4908 is a duplicate of this ticket.