html5/markup/js jump-indexes.js,1.6,1.7

Update of /sources/public/html5/markup/js
In directory hutz:/tmp/cvs-serv8901/js

Modified Files:
	jump-indexes.js 
Log Message:
made markup-consistency fix from Dom


Index: jump-indexes.js
===================================================================
RCS file: /sources/public/html5/markup/js/jump-indexes.js,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- jump-indexes.js	5 Aug 2010 05:40:28 -0000	1.6
+++ jump-indexes.js	5 Aug 2010 07:42:17 -0000	1.7
@@ -42,11 +42,14 @@
         if (document.body.className.indexOf("chunk") != -1) {
           if (itemName == 'toc') {
             a.setAttribute("href", "Overview.html#unexpanded-toc");
-          } else if (itemName == 'toggle') {
+          }
+          if (itemName == 'toggle') {
+            itemName = "";
             if (document.documentElement.id) {
               itemName = "#" + document.documentElement.id;
-            } else {
-              itemName = "";
+            }
+            if (window.location.hash) {
+              itemName = "#" + window.location.hash.substring(1,window.location.hash.length);
             }
             a.setAttribute("href", "spec.html" + itemName);
             itemName = "single";
@@ -57,10 +60,33 @@
           if (itemName == 'toc') {
             a.setAttribute("href", "#unexpanded-toc");
           } else if (itemName == 'toggle') {
+            itemName = "Overview.html";
             if (window.location.hash) {
-              itemName = window.location.hash.substring(1,window.location.hash.length) + ".html";
-            } else {
-              itemName = "Overview.html";
+              var fragID = window.location.hash.substring(1,window.location.hash.length);
+              if (fragID == 'index') {
+                itemName = "index.html";
+              }
+              for (var i = 0; i < document.getElementById('appendices').childNodes.length; i++) {
+                if (document.getElementById('appendices').childNodes[i].nodeName == 'DIV') {
+                  if (document.getElementById('appendices').childNodes[i].id == fragID) {
+                    itemName = window.location.hash.substring(1,window.location.hash.length) + ".html";
+                  }
+                }
+              }
+              for (var i = 0; i < document.getElementById('this_sections').childNodes.length; i++) {
+                if (document.getElementById('this_sections').childNodes[i].nodeName == 'DIV') {
+                  if (document.getElementById('this_sections').childNodes[i].id == fragID) {
+                    itemName = window.location.hash.substring(1,window.location.hash.length) + ".html";
+                  }
+                }
+              }
+              for (var i = 0; i < document.getElementById('elements').childNodes.length; i++) {
+                if (document.getElementById('elements').childNodes[i].nodeName == 'DIV') {
+                  if (document.getElementById('elements').childNodes[i].id == fragID) {
+                    itemName = window.location.hash.substring(1,window.location.hash.length) + ".html";
+                  }
+                }
+              }
             }
             a.setAttribute("href", itemName);
             itemName = "multi";

Received on Thursday, 5 August 2010 07:42:22 UTC