Skip to content
This repository has been archived by the owner on May 2, 2018. It is now read-only.

Commit

Permalink
misc/goplay: fix error on IE8.
Browse files Browse the repository at this point in the history
        use cancelBubble=true instead of preventDefault().

R=golang-dev, rsc, adg
CC=golang-dev
https://golang.org/cl/5888043
  • Loading branch information
mattn authored and adg committed Mar 27, 2012
1 parent 0c58eff commit a3b86e9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions misc/goplay/goplay.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,17 +209,25 @@ function autoindent(el) {
}, 1);
}
function preventDefault(e) {
if (e.preventDefault) {
e.preventDefault();
} else {
e.cancelBubble = true;
}
}
function keyHandler(event) {
var e = window.event || event;
if (e.keyCode == 9) { // tab
insertTabs(1);
e.preventDefault();
preventDefault(e);
return false;
}
if (e.keyCode == 13) { // enter
if (e.shiftKey) { // +shift
compile(e.target);
e.preventDefault();
preventDefault(e);
return false;
} else {
autoindent(e.target);
Expand Down

0 comments on commit a3b86e9

Please sign in to comment.