- From: Michael Smith via cvs-syncmail <cvsmail@w3.org>
- Date: Sat, 07 May 2011 11:02:05 +0000
- To: public-html-commits@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 UTC