Skip to main content

Bug Tracker

Side navigation

#5031 closed bug (worksforme)

Opened August 11, 2009 12:22PM UTC

Closed October 28, 2010 04:52AM UTC

height() returns 0 for children of hidden DIV (IE, Chrome, other brwsrs wasn't tested)

Reported by: aavolkoff Owned by:
Priority: major Milestone: 1.4
Component: core Version: 1.4.3
Keywords: height hidden div Cc:
Blocked by: Blocking:
Description

height(), innerHeight(), outerHeight() returns 0...

Code:


<div id="out" style="display:block">

</div>

<div id="in" style="display:none">

<div id="child">some text</div>

</div>

<script>

var kids = $("#in").children(); now array "kids" contains one DIV element named "child"

kids.each(function(index, domEle)

{

$("#out").append($(domEle));

var height = $(domEle).height();

alert(domEle.tagName+" "+height+"px");

});

</script>


Result:

Browser alert window says: "DIV 0px". It's wrong, because DIV height is 32px (or smth like that)...

But, if before alert() function I append DIV named "child" to DIV named "out" (in my example need to uncomment string) - all fine...

Attachments (0)
Change History (2)

Changed August 11, 2009 10:03PM UTC by dmethvin comment:1

component: unfilledcore

Changed October 28, 2010 04:52AM UTC by addyosmani comment:2

resolution: → worksforme
status: newclosed
version: 1.3.21.4.3

Testing this using jQuery 1.4.3 Live Test Case this appears to be working fine now.