Index: include.postload.js |
=================================================================== |
--- a/include.postload.js |
+++ b/include.postload.js |
@@ -190,6 +190,19 @@ |
return [l, t]; |
} |
+function isDisplayed(element) |
+{ |
+ while (element) |
+ { |
+ if (getComputedStyle(element).display == "none") |
+ return false; |
+ |
+ element = element.parentElement; |
+ } |
+ |
+ return true; |
+} |
+ |
// Adds an overlay to an element, which is probably a Flash object |
function addElementOverlay(elt) { |
// If this element is enclosed in an object tag, we prefer to block that instead |
@@ -200,6 +213,12 @@ |
// because we don't know how to construct a filter rule for it |
if(!hasFilters(elt)) |
return; |
+ |
+ // If the element isn't rendered (since its or one of its ancestor's |
+ // "diplay" property is "none"), the overlay wouldn't match the element. |
+ if (!isDisplayed(elt)) |
+ return; |
+ |
var thisStyle = getComputedStyle(elt, null); |
var overlay = document.createElement('div'); |
overlay.prisoner = elt; |