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

Unified Diff: include.preload.js

Issue 6317759025643520: Issue 1396 - Avoid infinite recursion when collapsing <input type="image"> elements (Closed)
Patch Set: Addressed comment Created Sept. 24, 2014, 5:01 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.preload.js
===================================================================
--- a/include.preload.js
+++ b/include.preload.js
@@ -47,11 +47,22 @@
{
if (response && element.parentNode)
{
+ var property = "display";
+ var value = "none";
+
// <frame> cannot be removed, doing that will mess up the frameset
if (tag == "frame")
- element.style.setProperty("visibility", "hidden", "important");
- else
- element.style.setProperty("display", "none", "important");
+ {
+ property = "visibility";
+ value = "hidden";
+ }
+
+ // <input type="image"> elements try to load their image again
+ // when the "display" CSS property is set. So we have to check
+ // that it isn't already collapsed to avoid an infinite recursion.
+ if (element.style.getPropertyValue(property) != value ||
+ element.style.getPropertyPriority(property) != "important")
+ element.style.setProperty(property, value, "important");
}
}
);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld