Bug Tracker

Opened 10 years ago

Closed 9 years ago

#5031 closed bug (worksforme)

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...

Change History (2)

comment:1 Changed 10 years ago by dmethvin

Component: unfilledcore

comment:2 Changed 9 years ago by addyosmani

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.

Note: See TracTickets for help on using tickets.