1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 22:22:27 +01:00

Work around failing getComputedStyle on Facebook.

getComputedStyle returns null for the channel_iframe document.
This commit is contained in:
Doug Kearns
2009-10-05 18:38:25 +11:00
parent f2b624b812
commit 66e3c4c95c

View File

@@ -252,11 +252,13 @@ function Hints() //{{{
function getContainerOffsets(doc)
{
let body = doc.body || doc.documentElement;
// TODO: getComputedStyle returns null for Facebook channel_iframe doc - probable Gecko bug.
let style = util.computedStyle(body);
if (/^(absolute|fixed|relative)$/.test(util.computedStyle(body)["position"]))
if (style && /^(absolute|fixed|relative)$/.test(style.position))
{
let bodyRect = body.getClientRects()[0];
return [-bodyRect.left, -bodyRect.top];
let rect = body.getClientRects()[0];
return [-rect.left, -rect.top];
}
else
return [doc.defaultView.scrollX, doc.defaultView.scrollY];