Hi All,
I've been debugging an issue with dynamic-height on Safari & Chrome. On both
of these browsers, we are seeing the height set to 0px rather than the gadget
height on our container implementation. In debugging this I notice that the
following method always returns 0:
function getHeightForWebkit() {
var result = 0;
var children = document.body.childNodes;
for (var i = 0; i < children.length; i++) {
if (children[i].offsetTop && children[i].offsetHeight) {
var bottom = children[i].offsetTop + children[i].scrollHeight
+ parseIntFromElemPxAttribute(children[i], "margin-bottom")
+ parseIntFromElemPxAttribute(children[i], "padding-bottom");
result = Math.max(result, bottom);
}
}
// Add margin and padding height specificed in the body (if any).
return result
}
For our test gadget, children[i].offsetTop = 0 (offsetHeight & scrollHeight =
1000), and therefore regardless of the value of offsetHeight, the following
always resolves to false:
if (children[i].offsetTop && children[i].offsetHeight) {
Therefore, bottom is never defined and the method always returns 0, setting our
gadget height to 0.
I'm not 100% sure how to fix it because I do not know the intent of the code.
Should this check even be there? Should it be checking for 'undefined'
instead? Also, why is it checking for children[i].offsetHeight yet then never
using it?
Any ideas on how to fix this would be appreciated.
--Steve