Re: parsing URI (references) according to RFC 3986

On 6/23/11 12:21 PM, Anne van Kesteren wrote:
> In a document /foo with a base URL http://example.org/ you have a link
> #foo (<a href="#foo">test</a>). This is considered a same-document
> reference and you will scroll down to #foo rather than go to
> http://example.org/. At least, per the latest set of RFCs. Earlier RFCs
> which Gecko followed are different (IIRC).

In the simple case, yes.

But what happens with

   window.open("#foo")

?  What about situations in which base URIs change?  What if instead of 
clicking the link, someone gets the .href of the anchor and then sets 
location of this or some other window to that?  Per the spec, the result 
of that .href should be a same-document reference which should scroll 
whatever window it's set to to the anchor 'foo' in that window, but 
that's not what UAs do.

Basically, the spec seems to assume that whatever action you plan to 
take with the URI immediately follows resolution wrt a base uri, and 
that this action is known at the time the resolution happens.  It's not 
clear to me why this assumption is justified.

In practice, the result is lack of interop on all but the simplest 
cases.  And I'm not talking just Gecko vs others; non-Gecko browsers 
don't agree with each other here.

-Boris

Received on Thursday, 23 June 2011 16:31:45 UTC