W3C home > Mailing lists > Public > public-html-commits@w3.org > May 2011

html5/spec-author-view dfn.js,1.20,1.21

From: Michael Smith via cvs-syncmail <cvsmail@w3.org>
Date: Sat, 07 May 2011 11:02:05 +0000
To: public-html-commits@w3.org
Message-Id: <E1QIfGv-0006GP-Da@lionel-hutz.w3.org>
Update of /sources/public/html5/spec-author-view
In directory hutz:/tmp/cvs-serv24063

Modified Files:
	dfn.js 
Log Message:
trap spacebar if event target is dfn


Index: dfn.js
===================================================================
RCS file: /sources/public/html5/spec-author-view/dfn.js,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- dfn.js	6 May 2011 04:09:06 -0000	1.20
+++ dfn.js	7 May 2011 11:02:03 -0000	1.21
@@ -47,16 +47,25 @@
   }
 }
 var dfnPanel;
-document.addEventListener('click', dfnShow, false);
-document.addEventListener("keydown", function(e) {
-  if(!e) e=window.event;
+document.addEventListener('click', window.dfnShow, false);
+document.addEventListener("keydown", function (e) {
+  if (!e) {
+    e = window.event;
+  }
   var key = e.keyCode ? e.keyCode : e.which;
-  if ( key == 27 && dfnPanel) {
+  if (key === 27 && dfnPanel) {
     dfnPanel.parentNode.removeChild(dfnPanel);
     dfnPanel = null;
   }
   if (key === 32 || key === 13) {
     window.dfnShow(e);
+    if (e.target.nodeName === "DFN") {
+      e.preventDefault();
+      e.stopPropagation();
+      e.returnValue = false;
+      e.cancelBubble = true;
+      return false;
+    }
   }
 }, true);
 function dfnShow(event) {
Received on Saturday, 7 May 2011 11:02:06 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 7 May 2011 11:02:07 GMT