Skip to main content

Bug Tracker

Side navigation

#14849 closed bug (wontfix)

Opened March 05, 2014 02:02AM UTC

Closed March 07, 2014 03:09PM UTC

Last modified March 07, 2014 06:30PM UTC

Improve outerWidth / outerHeight on hidden elements

Reported by: Owned by:
Priority: undecided Milestone: None
Component: css Version: 1.11.0-rc1
Keywords: Cc:
Blocked by: Blocking:

jQuery has a hack for returning width/height of hidden elements by briefly toggling their display:

This doesn't work when !important is used, which is pretty common for .hidden helper classes that need to have their style applied irrespective of the CSS specificity of later rules.

My brief exploration suggest that !important is respected on inline styles (for Chrome at least). So you might want to look into whether adding !important for each declaration in the line of code above makes the implementation work in more cases.

Attachments (0)
Change History (4)

Changed March 07, 2014 03:09PM UTC by timmywil comment:1

component: unfiledcss
resolution: → wontfix
status: newclosed

I think we want to steer clear of using !important anywhere in jQuery. The display hack is there to help provide useful values as often as possible, but it is not full-proof.

Changed March 07, 2014 06:26PM UTC by nicolas comment:2

I think we want to steer clear of using !important anywhere in jQuery.

Why though? We hit this bug at Twitter. The implementation should be more robust, especially given that every significant "CSS framework" uses "!important" in their helper classes for hiding elements. Either don't do any trickery at all, or make it solid.

Changed March 07, 2014 06:29PM UTC by dmethvin comment:3

If we could go back to "no trickery at all" we'd do that. All we can do now is draw the line at the trickery we've already implemented since we know it is a really bad idea both from a logic and performance standpoint. There is no end to the amount of trickery we'd need to do in order to figure out how a hidden element will look once it's displayed.

Changed March 07, 2014 06:30PM UTC by dmethvin comment:4

See also #14685