- From: Michael Smith via cvs-syncmail <cvsmail@w3.org>
- Date: Sat, 07 May 2011 10:55:25 +0000
- To: public-html-commits@w3.org
Update of /sources/public/html5/markup/js In directory hutz:/tmp/cvs-serv23534/js Modified Files: dfn.js Log Message: trap spacebar when dfn is event target Index: dfn.js =================================================================== RCS file: /sources/public/html5/markup/js/dfn.js,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- dfn.js 6 May 2011 03:48:25 -0000 1.12 +++ dfn.js 7 May 2011 10:55:23 -0000 1.13 @@ -26,16 +26,25 @@ document.body.className += " dfnEnabled"; } 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 10:55:27 UTC