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

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

From: Michael Smith via cvs-syncmail <cvsmail@w3.org>
Date: Sun, 08 May 2011 01:00:05 +0000
To: public-html-commits@w3.org
Message-Id: <E1QIsLt-0000QH-6F@lionel-hutz.w3.org>
Update of /sources/public/html5/spec-author-view
In directory hutz:/tmp/cvs-serv1504

Modified Files:
	dfn.js 
Log Message:
make popup disappear on tab out


Index: dfn.js
===================================================================
RCS file: /sources/public/html5/spec-author-view/dfn.js,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- dfn.js	7 May 2011 11:02:03 -0000	1.21
+++ dfn.js	8 May 2011 01:00:02 -0000	1.22
@@ -49,14 +49,35 @@
 var dfnPanel;
 document.addEventListener('click', window.dfnShow, false);
 document.addEventListener("keydown", function (e) {
+  var key, ns, p;
   if (!e) {
     e = window.event;
   }
-  var key = e.keyCode ? e.keyCode : e.which;
+  key = e.keyCode ? e.keyCode : e.which;
   if (key === 27 && dfnPanel) {
     dfnPanel.parentNode.removeChild(dfnPanel);
     dfnPanel = null;
   }
+  if (key === 9 && dfnPanel && e.target.parentNode.nodeName === "DD") {
+    ns = e.target.nextSibling;
+    while (ns && ns.nodeType !== ns.ELEMENT_NODE) {
+      ns = ns.nextSibling;
+    }
+    if (ns === null) {
+      p = event.target.parentNode;
+      while (p) {
+        console.dir(p);
+
+        p = p.nextSibling;
+        if (p && p.nodeName === "DD") {
+          break;
+        }
+      }
+      if (!p) {
+        dfnPanel.style.display = "none";
+      }
+    }
+  }
   if (key === 32 || key === 13) {
     window.dfnShow(e);
     if (e.target.nodeName === "DFN") {
Received on Sunday, 8 May 2011 01:00:06 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 8 May 2011 01:02:46 GMT