- From: Ian Hickson via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 15 Jun 2011 04:32:57 +0000
- To: public-html-commits@w3.org
Update of /sources/public/html5/spec In directory hutz:/tmp/cvs-serv10528 Modified Files: Overview.html Log Message: it was pointed out that Unix paths can contain backslashes (whatwg r6229) Index: Overview.html =================================================================== 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 Wednesday, 15 June 2011 04:32:59 UTC