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

2009/dap/ReSpec.js/js simple-node.js,1.9,1.10

From: Robin Berjon via cvs-syncmail <cvsmail@w3.org>
Date: Mon, 02 May 2011 10:12:36 +0000
To: public-dap-commits@w3.org
Message-Id: <E1QGq7I-0000NH-7u@lionel-hutz.w3.org>
Update of /sources/public/2009/dap/ReSpec.js/js
In directory hutz:/tmp/cvs-serv1420/js

Modified Files:
	simple-node.js 
Log Message:
sanitise generated IDs better

Index: simple-node.js
===================================================================
RCS file: /sources/public/2009/dap/ReSpec.js/js/simple-node.js,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- simple-node.js	2 May 2011 10:09:36 -0000	1.9
+++ simple-node.js	2 May 2011 10:12:34 -0000	1.10
@@ -120,8 +120,8 @@
     },
     
     sanitiseID:    function (id) {
-        id = id.split(/[^-.0-9a-z_]/).join("-");
-        id = id.replace(/^-+/, "");
+        id = id.split(/[^-.0-9a-zA-Z_]/).join("-");
+        id = id.replace(/^-+/g, "");
         id = id.replace(/-+$/, "");
         if (id.length > 0 && /^[^a-z]/.test(id)) id = "x" + id;
         if (id.length == 0) id = "generatedID";
Received on Monday, 2 May 2011 10:12:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 2 May 2011 10:12:37 GMT