jQuery: The Write Less, Do More JavaScript Library

Ticket #2185 (new bug)

Opened 7 months ago

Last modified 6 months ago

slideToggle doesn't preserve "display" style

Reported by: Johnath Assigned to: anonymous
Type: bug Priority: minor
Milestone: 1.2.3 Component: fx
Version: 1.2.2 Keywords:
Cc: Needs: Review

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

Change History

Changed 7 months ago by michaeltsmith85

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 6 months ago by josephtate

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.

Note: See TracTickets for help on using tickets.