This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 17155 - The "navigating to a fragment identifier" algorithm shouldn't be async
Summary: The "navigating to a fragment identifier" algorithm shouldn't be async
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Needs Research
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-23 09:53 UTC by James Graham
Modified: 2013-04-22 18:01 UTC (History)
2 users (show)

See Also:


Attachments

Description James Graham 2012-05-23 09:53:34 UTC
When UAs navigate to fragment identifiers they seem to do it in a sync way i.e. 

location.hash = "#bar"
//location.hash is now "#bar"

However the hashchange event seems to be queued rather than fired synchronously so that
location.hash = "foo"
onhashchange = function(e) {document.body.innerHTML += "<p> " + e.oldURL + " " + e.newURL}
location.hash = "bar"

causes the event to be fired twice.

For other navigations, the async behaviour seems to be correct.
Comment 1 James Graham 2012-05-23 10:01:30 UTC
Also, the scrolling seems to happen synchronously
Comment 2 contributor 2012-07-18 17:33:57 UTC
This bug was cloned to create bug 18178 as part of operation convergence.
Comment 3 James Graham 2012-08-01 11:26:46 UTC
And the popstate event is async.
Comment 4 Ian 'Hixie' Hickson 2012-10-30 00:25:08 UTC
There seem to be multiple bugs here.

Do you have some test cases?

Are things like pending history.back() calls aborted as well? Is the new session history entry added synchronously or asynchronously? (Might be able to tell by judicious use of back()/forwards() after the setter is invoked.)

I guess the "Traverse the History" algorithm needs to be given a flag to decide whether the events are sync or async? That's unfortunate. Are the events synchronous in the same task? Or two different tasks?
Comment 5 contributor 2013-04-22 18:01:59 UTC
Checked in as WHATWG revision r7846.
Check-in comment: Try to match reality better for dynamic location.hash navigation.
http://html5.org/tools/web-apps-tracker?from=7845&to=7846