diff options
author | Yasuhiro Matsumoto <mattn.jp@gmail.com> | 2012-03-27 11:16:29 +1100 |
---|---|---|
committer | Yasuhiro Matsumoto <mattn.jp@gmail.com> | 2012-03-27 11:16:29 +1100 |
commit | d1284f84393ac5efcc46d9e07c3060bb5e941bda (patch) | |
tree | 4e2abd5e8a8f13f7b7334a581b71e8d425ad581e /misc/goplay | |
parent | e4fcfef28eb8c41940eb208489ef050f99496d34 (diff) | |
download | go-d1284f84393ac5efcc46d9e07c3060bb5e941bda.tar.gz |
misc/goplay: fix error on IE8.
use cancelBubble=true instead of preventDefault().
R=golang-dev, rsc, adg
CC=golang-dev
http://codereview.appspot.com/5888043
Committer: Andrew Gerrand <adg@golang.org>
Diffstat (limited to 'misc/goplay')
-rw-r--r-- | misc/goplay/goplay.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/misc/goplay/goplay.go b/misc/goplay/goplay.go index c113abb6f..9ce4f89ae 100644 --- a/misc/goplay/goplay.go +++ b/misc/goplay/goplay.go @@ -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); |