[whatwg] Document's base URI should use the document's *current* address

On Wed, Feb 15, 2012 at 5:31 PM, Ian Hickson <ian at hixie.ch> wrote:
> On Wed, 15 Feb 2012, Justin Lebar wrote:
>> > ?- It sets "the document's current address" to ".../page.html#foo".
>>
>> Well, this is pretty bad. ?document.location is the document's current
>> address [1]. ?So clicking #foo changed document.location from page2.html
>> to page.html#foo, which I certainly wouldn't expect (and does not match
>> implementations).
>
> Seems to me we should change the implementations then. There isn't any
> fundamental difference between linking to #foo and linking to
> page.html#foo if the base URL is page.html, as far as I can tell.
>
> If the implementations can't change, then I'll change the spec, but it
> really seems bad to me that relative URLs will break depending on when
> they are resolved relative to pushState() changes.

When I implemented pushState, I explicitly didn't want authors to have
to rewrite all their anchor links after they changed the document's
current URI.

>From an author's point of view, there's no such thing as the
document's original URI and, unless you're a nerd, you've never heard
of the base URI.  There's just the document's URI, modified by
pushState.

>From this point of view, I'd say it's less surprising that relative
URIs would break when you change directories (hey, you *asked* for it)
than that anchor refs would update the browser's address bar and
document.location relative to the old URI.

If we did make the change you're suggesting, we'd have to check that
it doesn't break at least the major sites which use pushstate
(Facebook, anyone?).  And I'd want to try to coordinate the change
with WebKit so we quickly move away from the old behavior.  But I'm
not convinced it's worthwhile, given that there's at least an argument
for the current behavior.

-Justin

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

Received on Wednesday, 15 February 2012 22:03:53 UTC