[whatwg] Setting document.location.hash to a not-yet-loaded element

On Thu, 3 Sep 2009, Aryeh Gregor wrote:
>
> Consider the following test page:
> 
> <!doctype html>
> <title>test</title>
> <script>document.location = "#frag"</script>
> <div style="margin-top: 100em"></div>
> <p id=frag>Jump to me!</p>
> 
> Observed behavior in both Chrome 4 and Opera 9.6 is that the browser
> jumps to the given fragment; Firefox 3.5 does not.  I believe all
> versions of IE jump to the fragment as well, since MediaWiki relies on
> this, although I haven't personally tested.
> 
> The issue is, of course, that at the time document.location is set, no
> element with id "frag" exists in the document.  However, IMO it's
> expected that setting a fragment should cause the same behavior as if
> the user had navigated to the document with that fragment to begin
> with -- namely, that the UA jumps to the fragment when it loads.
> 
> The current text of the specification appears to support Firefox's 
> behavior [...]

Fixed.

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

Received on Sunday, 13 September 2009 14:34:06 UTC