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 9560 - [history] The line game example doesn't work properly
Summary: [history] The line game example doesn't work properly
Status: RESOLVED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: pre-LC1 HTML5 spec (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-20 18:30 UTC by Jeff Muizelaar
Modified: 2010-10-04 14:47 UTC (History)
5 users (show)

See Also:


Attachments

Description Jeff Muizelaar 2010-04-20 18:30:55 UTC
The example includes an element like:

<a href="?x=6" onclick="go(1)">Advance to 6</a>

The onclick handler should include a "return false" so that we don't switch pages and instead use only use pushState().
Comment 1 HE Shi-Jun 2010-05-28 08:33:54 UTC
As my understandings of the intention of pushState/popstate and the descriptions in the Mozilla site (https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history#State_information_for_history_entries), this line of code seems broken:

function go(d) {
   history.pushState(currentPage, 'Line Game - ' + currentPage, '?x=' + currentPage);
   setupPage(currentPage + d);
}


It should be:

function go(d) {
   setupPage(currentPage + d);
   history.pushState(currentPage, 'Line Game - ' + currentPage, '?x=' + currentPage);
}
Comment 2 Ian 'Hixie' Hickson 2010-08-25 23:34:04 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Partially Accepted
Change Description: see diff given below
Rationale: Fixed the issue in the original description. However, the issue in comment 1 is based on a misunderstanding of pushState() -- pushState() pushes the _previous_ state, not the current one.
Comment 3 contributor 2010-08-25 23:34:24 UTC
Checked in as WHATWG revision r5351.
Check-in comment: fix example
http://html5.org/tools/web-apps-tracker?from=5350&to=5351
Comment 4 Ian 'Hixie' Hickson 2010-08-26 01:56:23 UTC
Er, nevermind. The misunderstanding was my own. Fixed comment 1, see diff below.
Comment 5 contributor 2010-08-26 01:57:05 UTC
Checked in as WHATWG revision r5355.
Check-in comment: fix pushState() example
http://html5.org/tools/web-apps-tracker?from=5354&to=5355