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

Unified Diff: safari/ext/content.js

Issue 5641434644348928: Fixed element collapsing in Safari (Closed)
Patch Set: Created Jan. 15, 2014, 7:34 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: safari/ext/content.js
===================================================================
--- a/safari/ext/content.js
+++ b/safari/ext/content.js
@@ -279,6 +279,9 @@
/* Web request blocking */
+ var errorEvent = document.createEvent("Event");
+ errorEvent.initEvent("error");
+
document.addEventListener("beforeload", function(event)
{
var type;
@@ -318,7 +321,14 @@
isTopLevel: window == window.top
}
}))
+ {
event.preventDefault();
+
+ // Safari doesn't dispatch an "error" event when preventing an element
+ // from loading by cancelling the "beforeload" event. So we have to
+ // dispatch it manually. Otherwise element collapsing wouldn't work.
+ event.target.dispatchEvent(errorEvent);
Wladimir Palant 2014/01/16 09:21:24 a) Does Safari really allow dispatching the same e
Sebastian Noack 2014/01/16 13:20:56 Apparently it does. But if that is non-standard, I
+ }
}, true);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld