W3C home > Mailing lists > Public > public-dap-commits@w3.org > April 2011

2009/dap/ReSpec.js/js respec.js,1.147,1.148

From: Robin Berjon via cvs-syncmail <cvsmail@w3.org>
Date: Fri, 29 Apr 2011 14:06:59 +0000
To: public-dap-commits@w3.org
Message-Id: <E1QFoLT-00028Q-MB@lionel-hutz.w3.org>
Update of /sources/public/2009/dap/ReSpec.js/js
In directory hutz:/tmp/cvs-serv8188/js

Modified Files:
	respec.js 
Log Message:
this should help avoid the duplicate IDs for overloaded methods

Index: respec.js
===================================================================
RCS file: /sources/public/2009/dap/ReSpec.js/js/respec.js,v
retrieving revision 1.147
retrieving revision 1.148
diff -u -d -r1.147 -r1.148
--- respec.js	29 Apr 2011 13:52:12 -0000	1.147
+++ respec.js	29 Apr 2011 14:06:57 -0000	1.148
@@ -2007,9 +2007,8 @@
                 var dl = sn.element("dl", { "class": type + "s" }, sec);
                 for (var j = 0; j < things.length; j++) {
                     var it = things[j];
-                    var id = sn.idThatDoesNotExist(curLnk + it.refId);
-                    console.log("ID=" + id);
-                    var dt = sn.element("dt", { id: curLnk + it.refId }, dl);
+                    var id = (type == "method") ? this.makeMethodID(curLnk, it) : sn.idThatDoesNotExist(curLnk + it.refId);
+                    var dt = sn.element("dt", { id: id }, dl);
                     sn.element("code", {}, dt, it.id);
                     var desc = sn.element("dd", {}, dl, [it.description]);
                     if (type == "method") {
@@ -2143,6 +2142,18 @@
         }
     },
     
+    makeMethodID:    function (cur, obj) {
+        var id = cur + obj.refId + "-" + obj.datatype + "-";
+        var params = [];
+        for (var i = 0, n = obj.params.length; i < n; i++) {
+            var prm = obj.params[i];
+            params.push(prm.datatype + (prm.array ? "Array" : "") + "-" + prm.id)
+        }
+        id += params.join("-");
+        return id;
+        // return sn.idThatDoesNotExist(id);
+    },
+    
     writeAsWebIDL:    function (obj, indent) {
         if (obj.type == "module") {
             if (obj.id == "outermost") {
@@ -2290,7 +2301,9 @@
         var arr = meth.array ? "[]" : "";
         str += "<span class='idlMethType'>" + this.writeDatatype(meth.datatype) + arr + nullable + "</span> ";
         for (var i = 0; i < pad; i++) str += " ";
-        str += "<span class='idlMethName'><a href='#" + curLnk + meth.refId + "'>" + meth.id + "</a></span> (";
+        var id = this.makeMethodID(curLnk, meth);
+        // str += "<span class='idlMethName'><a href='#" + curLnk + meth.refId + "'>" + meth.id + "</a></span> (";
+        str += "<span class='idlMethName'><a href='#" + id + "'>" + meth.id + "</a></span> (";
         var obj = this;
         str += meth.params.map(function (it) {
                                     var nullable = it.nullable ? "?" : "";
Received on Friday, 29 April 2011 14:07:01 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 29 April 2011 14:07:01 GMT