[whatwg] Proposal for improved handling of '#' inside of data URIs

Aryeh Gregor ayg at aryeh.name
Mon Sep 12 11:25:05 PDT 2011


On Mon, Sep 12, 2011 at 7:19 AM, Simon Pieters <simonp at opera.com> wrote:
> Making it magic seems confusing and error prone. Making data: URLs not
> support fragments at all seems to be taking away a useful feature. I think
> we should stick to the "correct" behavior and always treat # as fragment
> delimiter in data: URLs. I thought we did this already in Opera but
> apparently we have some bugs. If you have any test cases demonstrating where
> Opera doesn't follow the spec, that would be helpful in getting it fixed.

I was surprised at first by the fact that # was always treated as a
fragment delimiter in data: URLs by some browsers, but after reading
this thread, I agree it's the only sane choice.  It's not what I'd
initially expected, but if that's how all browsers behaved, I'd have
figured it out pretty quickly.

I find Michael's point about % particularly convincing.  Authors have
to encode % anyway for their data URL handling to be robust, and once
they're doing that, encoding # is not much extra effort.  Making #
work without encoding encourages authors to forget about %.  Trying to
key off </> for text/html only is just a really scary and evil hack.
If browsers agreed on treating # in data URLs like in any other URL,
authors would quickly figure it out and remember to encode.  I think
this is the best solution by far.

This is assuming that the compat issues aren't bad enough to rule it
out, of course . . .



More information about the whatwg mailing list