dynamic-height not working on Safari and Chrome
-----------------------------------------------
Key: SHINDIG-1118
URL: https://issues.apache.org/jira/browse/SHINDIG-1118
Project: Shindig
Issue Type: Bug
Components: Javascript
Reporter: Stephen Voorhees
Attachments: dynamic-height.patch
<<Patch attached>>
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.
The fix for this issue is to change the if condition above to the following:
if (typeof children[i].offsetTop !== 'undefined' &&
typeof children[i].scrollHeight !== 'undefined')
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.