Skip to content

Commit

Permalink
FIX FOR IE7: Ie7 will throw an error whenever you click on any of the…
Browse files Browse the repository at this point in the history
… UI buttons because IE has an (of course) non-standard implementation of the event.target attribute. IE instead uses event.srcElement, but it can't even check for event.target being undefined because passing in events is borked too -- so we have to take the event from the window and overwrite the function event for IE, then check for it to be undefined. The behavior is unchanged for standards compliant browsers
  • Loading branch information
martajd authored and jagthedrummer committed Feb 8, 2014
1 parent 3bb1428 commit 2a06199
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion js/codemirror-ui.js
Expand Up @@ -295,7 +295,15 @@ CodeMirrorUI.prototype = {
button.func = func.cmuiBind(this);
button.onclick = function(event) {
//alert(event.target);
event.target.func();

//normalize for IE
event = event ? event : window.event;
if (typeof event.target == 'undefined') {
var target = event.srcElement;
} else {
var target = event.target;
}
target.func();
return false;
//this.self[action].call(this);
//eval("this."+action)();
Expand Down

0 comments on commit 2a06199

Please sign in to comment.