[whatwg] Fakepath revisited

On Mon, 14 Sep 2009, Eduard Pascual wrote:
> Now, maybe stepping on a side topic, I'd like to bring back a separate 
> request: I think, if fakepath is to be included on the spec, that 
> content authors shouldn't be left at their own risks. Considering that 
> "pre-HTML5" browsers (like IE 6 and 7 or FF2) are going to stay there 
> for a while, approaches like substr(12) or any other means of just 
> trimming "C:\fakepath\" just won't work. Last indexof("\\") would break 
> on any browser that doesn't include path at all (that's what fakepath is 
> addressing, after all), as well as any browser that runs on Unix-like 
> systems and provides full path (not sure if there is any current browser 
> on this category).
> Is there any way we content authors can reliably retrieve a filename 
> from scripts, other than special-casing several versions of each browser 
> in existence?
> More specifically, would .files[0] work on those "pre-HTML5" browsers? 
> If it does, this is a non-issue. However, if it doesn't, I'd like to 
> suggest adding an algorythm on the spec to deal with this task. Just 
> like the spec offers algorythms for browsers to deal with non-compliant 
> existing content, on cases like this it would be equally valuable to 
> have algorythms for content to deal with non-compliant existing 
> browsers.

files[0] won't work in most legacy browsers. I've added an example of how 
to grab the filename.

On Mon, 14 Sep 2009, Alex Henrie wrote:
> Then for however long we use HTML, we will always remember that we have 
> to work around fakepath because someone decided that compatibility with 
> a handful of badly designed pages in 2009 was more important than having 
> good design in 2090.

If only this was the only thing for which we could say that. :-(

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Tuesday, 15 September 2009 05:04:11 UTC