- From: poot <cvsmail@w3.org>
- Date: Fri, 17 Jun 2011 05:52:21 -0400
- To: public-html-diffs@w3.org
hixie: it was pointed out that Unix paths can contain backslashes
(whatwg r6229)
http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.4992&r2=1.4993&f=h
http://html5.org/tools/web-apps-tracker?from=6228&to=6229
===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.4992
retrieving revision 1.4993
diff -u -d -r1.4992 -r1.4993
--- Overview.html 15 Jun 2011 00:02:04 -0000 1.4992
+++ Overview.html 15 Jun 2011 04:32:53 -0000 1.4993
@@ -34901,13 +34901,16 @@
following function extracts the filename in a suitably compatible
manner:</p>
- <pre>function extractFilename(path) { var x;
- x = path.lastIndexOf('\\');
- if (x >= 0) // Windows-based path
- return path.substr(x+1);
+ <pre>function extractFilename(path) {
+ if (path.substr(0, 12) == "C:\\fakepath\\")
+ return path.substr(12); // modern browser
+ var x;
x = path.lastIndexOf('/');
if (x >= 0) // Unix-based path
return path.substr(x+1);
+ x = path.lastIndexOf('\\');
+ if (x >= 0) // Windows-based path
+ return path.substr(x+1);
return path; // just the filename
}</pre>
Received on Friday, 17 June 2011 09:52:22 UTC