W3C home > Mailing lists > Public > public-dap-commits@w3.org > January 2010

2009/dap/ReSpec.js/js respec.js,1.78,1.79

From: Robin Berjon via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 28 Jan 2010 15:54:54 +0000
To: public-dap-commits@w3.org
Message-Id: <E1NaWhq-0006CA-UA@lionel-hutz.w3.org>
Update of /sources/public/2009/dap/ReSpec.js/js
In directory hutz:/tmp/cvs-serv23800/ReSpec.js/js

Modified Files:
	respec.js 
Log Message:
ReSpec now cleans whiter than white

Index: respec.js
===================================================================
RCS file: /sources/public/2009/dap/ReSpec.js/js/respec.js,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- respec.js	28 Jan 2010 15:29:20 -0000	1.78
+++ respec.js	28 Jan 2010 15:54:52 -0000	1.79
@@ -170,6 +170,7 @@
             this.informative();
             this.fixHeaders();
             this.makeTOC();
+            this.idHeaders();
 
             if (respecConfig.postProcess) {
                 for (var i = 0; i < respecConfig.postProcess.length; i++) respecConfig.postProcess[i].apply(this);
@@ -626,6 +627,17 @@
         return ul;
     },
 
+    idHeaders:    function () {
+        var heads = document.querySelectorAll("h2, h3, h4, h5, h6");
+        for (var i = 0; i < heads.length; i++) {
+            var h = heads[i];
+            if (h.hasAttribute("id")) continue;
+            var par = h.parentNode;
+            if (par.localName == "div" && par.hasAttribute("id") && !h.previousElementSibling) continue;
+            sn.makeID(h, null);
+        }
+    },
+    
     // --- INLINE PROCESSING ----------------------------------------------------------------------------------
     inlines:    function () {
         document.normalize();
Received on Thursday, 28 January 2010 15:54:58 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 28 January 2010 15:54:59 GMT