Re: [whatwg/url] javascript: URL parsing (#307)

So this is interesting. [Live URL viewer](https://quuz.org/url/liveview.html#javascript:window.location.replace(%22https://whatsoever.com/?a=b&c=5&x=y%22)) indicates:

- Firefox stores the data somewhere else entirely which is not accessible except through `href`
- Chrome almost matches the spec, except it does not percent-encode the closing quote in the search
- Safari Tech Preview matches the spec entirely (yay!)
- Edge stores everything in the pathname

Can you think of a more convoluted example where parsing, serializing, percent-decoding, and stripping off leading `javascript:` does not round trip? My intuition is that there would be one; those steps don't really seem like the reverse of each other. But I can't find one by tinkering.

At this point I'm leaning toward just adding tests and not changing anything in either spec. I think it might be nicer for developers if everything was in the pathname, but I understand the argument about not wanting to pollute the URL parser with scheme-specific parsers.

Maybe a compromise would be to define this "recover everything after the scheme as a string" operation so that other specs like HTML could refer to it? You could also imagine a theoretical spec for a mail client which receives mailto: URLs wanting to use such a mechanism.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/issues/307#issuecomment-299052138

Received on Wednesday, 3 May 2017 22:21:48 UTC