﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,blockedby,blocking 14685,.height() inconsistencies with hidden elements,ult_combo,,"I'm aware that upon trying to retrieve the `.height()` of an element, jQuery currently swaps `display:none` by `display:block` ([https://github.com/jquery/jquery/blob/24e587929f62428e1959b10aace6dc4fd65ab397/src/css.js#L347-L350 source]), but it also adds `position:absolute` as part of the [https://github.com/jquery/jquery/blob/3ca883f863f8c4b3b1153e63ef40a8c2c523d399/src/css.js#L30 cssShow object], which takes the element out of the normal document flow and thus no longer respect the original line-breaking rules. This makes a difference when the element's height varies depending on the automatic line-breaking. See this [http://jsfiddle.net/WU7fL/ fiddle] with 3 identical elements, where `.height()` returns a different value for each one. So, `.height()` ""works"" on hidden elements but the returned value is sometimes inconsistent with the height that would be obtained if the given element was being shown (`display:block`) inside the normal document flow. Another inconsistency is that even though `.height()` works on elements with `display:none`, it will fail when an ancestor of the element has `display:none`, as the previously linked cssShow `$.swap` is only applied to the element being measured. ---- Changing that cssShow `$.swap` by a `.show()`, measure, `.hide()` would be more accurate in my opinion (keeping element in the document flow). I'm not sure about elements with hidden ancestors. Any change here could cause back-compat issues, maybe add an optional ""makeSureElementIsVisible"" parameter to recursively display hidden ancestors in the `.height()`/`.width()` getter functions. ---- '''tl;dr:''' - `.height()` screws line breaking due to absolute positioning and is thus inconsistent on hidden elements; - `.height()` works on hidden elements (`display:none`) but does not work on elements with a hidden ancestor. I believe this behavior is rather confusing, thus reporting as a bug. Note: I believe all this also applies to `.width()` as well, since they share the same getter hook.",bug,closed,undecided,None,unfiled,1.10.2,notabug,,,,