]> Cypherpunks repositories - gostls13.git/commitdiff
misc/goplay: fix Tab and Shift+Enter in Firefox.
authorDmitry Chestnykh <dchest@gmail.com>
Sat, 16 Apr 2011 08:44:51 +0000 (18:44 +1000)
committerAndrew Gerrand <adg@golang.org>
Sat, 16 Apr 2011 08:44:51 +0000 (18:44 +1000)
Fixes #1633.

R=adg, dsymonds
CC=golang-dev
https://golang.org/cl/4439042

misc/goplay/goplay.go

index f887fbbda7efd52aa69fc59bc7a9e647c9b26754..f3e2ff565168e95641507ce7742b026d8b5fc320 100644 (file)
@@ -235,8 +235,8 @@ function autoindent(el) {
        }, 1);
 }
 
-function keyHandler() {
-       var e = window.event;
+function keyHandler(event) {
+       var e = window.event || event;
        if (e.keyCode == 9) { // tab
                insertTabs(1);
                e.preventDefault();
@@ -290,7 +290,7 @@ function compileUpdate() {
 </head>
 <body>
 <table width="100%"><tr><td width="60%" valign="top">
-<textarea autofocus="true" id="edit" spellcheck="false" onkeydown="keyHandler();" onkeyup="autocompile();">«@|html»</textarea>
+<textarea autofocus="true" id="edit" spellcheck="false" onkeydown="keyHandler(event);" onkeyup="autocompile();">«@|html»</textarea>
 <div class="hints">
 (Shift-Enter to compile and run.)&nbsp;&nbsp;&nbsp;&nbsp;
 <input type="checkbox" id="autocompile" value="checked" /> Compile and run after each keystroke