Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: include.postload.js

Issue 6463903206735872: Issue 1606 - Don't create overlays for hidden elements (Closed)
Patch Set: Use offsetParent Created Nov. 25, 2014, 5:15 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include.postload.js
===================================================================
--- a/include.postload.js
+++ b/include.postload.js
@@ -200,6 +200,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.
Wladimir Palant 2014/11/26 13:10:18 Nit: "display"
+ if (!elt.offsetParent)
Wladimir Palant 2014/11/26 13:10:18 What about elements that use visibility:hidden or
Sebastian Noack 2014/11/26 13:15:07 We don't have to bother about those. In that case
+ return;
+
var thisStyle = getComputedStyle(elt, null);
var overlay = document.createElement('div');
overlay.prisoner = elt;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld