mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 20:22:26 +01:00
Work around failing getComputedStyle on Facebook.
getComputedStyle returns null for the channel_iframe document.
This commit is contained in:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user