- From: Anssi Kostiainen via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 13 Sep 2011 10:05:34 +0000
- To: public-dap-commits@w3.org
Update of /sources/public/2009/dap/ReSpec.js/js
In directory hutz:/tmp/cvs-serv31910
Modified Files:
respec.js
Log Message:
add support for merging dictionaries with interface IDL via data-merge attribute on the interface <dl>
Index: respec.js
===================================================================
RCS file: /sources/public/2009/dap/ReSpec.js/js/respec.js,v
retrieving revision 1.164
retrieving revision 1.165
diff -u -d -r1.164 -r1.165
--- respec.js 13 Sep 2011 06:17:59 -0000 1.164
+++ respec.js 13 Sep 2011 10:05:31 -0000 1.165
@@ -1627,6 +1627,11 @@
inf.partial = !!match[1];
inf.id = match[2];
inf.refId = this._id(inf.id);
+ if (idl.getAttribute('data-merge')) {
+ inf.merge = [];
+ var merge = idl.getAttribute('data-merge').split(' ');
+ for (var i = 0; i < merge.length; i++) inf.merge.push(merge[i]);
+ }
if (match[3]) inf.superclasses = match[3].split(/\s*,\s*/);
}
else {
@@ -2153,7 +2158,10 @@
}
var sec = sn.element("section", {}, df);
- sn.element("h2", {}, sec, "Dictionary Members");
+ cnt = [sn.text("Dictionary "),
+ sn.element("a", { "class": "idlType" }, null, obj.id),
+ sn.text(" Members")];
+ sn.element("h2", {}, sec, cnt);
var dl = sn.element("dl", { "class": "dictionary-members" }, sec);
for (var j = 0; j < things.length; j++) {
var it = things[j];
@@ -2335,6 +2343,18 @@
}
}
}
+ if (typeof obj.merge !== "undefined" && obj.merge.length > 0) {
+ // hackish: delay the execution until the DOM has been initialized, then merge
+ setTimeout(function () {
+ for (var i = 0; i < obj.merge.length; i++) {
+ var idlInterface = document.querySelector("#idl-def-" + obj.refId),
+ idlDictionary = document.querySelector("#idl-def-" + obj.merge[i]);
+ idlDictionary.parentNode.parentNode.removeChild(idlDictionary.parentNode);
+ idlInterface.appendChild(document.createElement("p"));
+ idlInterface.appendChild(idlDictionary);
+ }
+ }, 0);
+ }
return df;
}
},
Received on Tuesday, 13 September 2011 10:05:36 UTC