[html5] r6229 - [e] (0) it was pointed out that Unix paths can contain backslashes
whatwg at whatwg.org
whatwg at whatwg.org
Tue Jun 14 21:32:49 PDT 2011
Author: ianh
Date: 2011-06-14 21:32:48 -0700 (Tue, 14 Jun 2011)
New Revision: 6229
Modified:
complete.html
index
source
Log:
[e] (0) it was pointed out that Unix paths can contain backslashes
Modified: complete.html
===================================================================
--- complete.html 2011-06-15 00:01:59 UTC (rev 6228)
+++ complete.html 2011-06-15 04:32:48 UTC (rev 6229)
@@ -46305,16 +46305,16 @@
following function extracts the filename in a suitably compatible
manner:</p>
- <pre>function extractFilename(path) {<!--
+ <pre>function extractFilename(path) {
if (path.substr(0, 12) == "C:\\fakepath\\")
- return path.substr(12);-->
+ 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);
- x = path.lastIndexOf('/');
- if (x >= 0) // Unix-based path
- return path.substr(x+1);
return path; // just the filename
}</pre>
Modified: index
===================================================================
--- index 2011-06-15 00:01:59 UTC (rev 6228)
+++ index 2011-06-15 04:32:48 UTC (rev 6229)
@@ -46298,16 +46298,16 @@
following function extracts the filename in a suitably compatible
manner:</p>
- <pre>function extractFilename(path) {<!--
+ <pre>function extractFilename(path) {
if (path.substr(0, 12) == "C:\\fakepath\\")
- return path.substr(12);-->
+ 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);
- x = path.lastIndexOf('/');
- if (x >= 0) // Unix-based path
- return path.substr(x+1);
return path; // just the filename
}</pre>
Modified: source
===================================================================
--- source 2011-06-15 00:01:59 UTC (rev 6228)
+++ source 2011-06-15 04:32:48 UTC (rev 6229)
@@ -51920,16 +51920,16 @@
following function extracts the filename in a suitably compatible
manner:</p>
- <pre>function extractFilename(path) {<!--
+ <pre>function extractFilename(path) {
if (path.substr(0, 12) == "C:\\fakepath\\")
- return path.substr(12);-->
+ 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);
- x = path.lastIndexOf('/');
- if (x >= 0) // Unix-based path
- return path.substr(x+1);
return path; // just the filename
}</pre>
More information about the Commit-Watchers
mailing list