1
0
mirror of https://github.com/golang/go synced 2024-11-24 07:40:17 -07:00

misc/goplay: fix error on IE8.

use cancelBubble=true instead of preventDefault().

R=golang-dev, rsc, adg
CC=golang-dev
https://golang.org/cl/5888043
This commit is contained in:
Yasuhiro Matsumoto 2012-03-27 11:16:29 +11:00 committed by Andrew Gerrand
parent 0c58eff0b6
commit a3b86e9379

View File

@ -209,17 +209,25 @@ function autoindent(el) {
}, 1); }, 1);
} }
function preventDefault(e) {
if (e.preventDefault) {
e.preventDefault();
} else {
e.cancelBubble = true;
}
}
function keyHandler(event) { function keyHandler(event) {
var e = window.event || event; var e = window.event || event;
if (e.keyCode == 9) { // tab if (e.keyCode == 9) { // tab
insertTabs(1); insertTabs(1);
e.preventDefault(); preventDefault(e);
return false; return false;
} }
if (e.keyCode == 13) { // enter if (e.keyCode == 13) { // enter
if (e.shiftKey) { // +shift if (e.shiftKey) { // +shift
compile(e.target); compile(e.target);
e.preventDefault(); preventDefault(e);
return false; return false;
} else { } else {
autoindent(e.target); autoindent(e.target);