<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>17811</bug_id>
          
          <creation_ts>2012-07-18 06:53:25 +0000</creation_ts>
          <short_desc>Expose history traversal direction</short_desc>
          <delta_ts>2012-12-07 22:49:05 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#traverse-the-history</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>annevk</cc>
    
    <cc>ian</cc>
    
    <cc>mail</cc>
    
    <cc>mike</cc>
    
    <cc>nekr.fabula</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>70092</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2012-07-18 06:53:25 +0000</bug_when>
    <thetext>This was was cloned from bug 15366 as part of operation convergence.
Originally filed: 2011-12-30 11:21:00 +0000
Original reporter: Anne &lt;annevk@annevk.nl&gt;

================================================================================
 #0   Anne                                            2011-12-30 11:21:40 +0000 
--------------------------------------------------------------------------------
E.g. for CSS transitions it would be nice if history traversal direction was known. Especially now there&apos;s history.pushState(). You can track this yourself but it would be nicer if it was explicitly exposed.

(Feedback from Ben Joffe.)
================================================================================
 #1   Ben Joffe                                       2011-12-30 11:35:00 +0000 
--------------------------------------------------------------------------------
Perhaps this could be a property of the event object as an integer (defined the same as the argument that could have been passed to history.go to trigger the navigation).

Another reason to want this property: some navigational states may be associated with an xhr request, if the navigation is back then it may be appropriate to display the previous result of that request, but if it is forward it may be appropriate to redo the request.
================================================================================
 #2   Ian &apos;Hixie&apos; Hickson                             2012-02-01 00:54:32 +0000 
--------------------------------------------------------------------------------
Interesting idea.

Sometimes the direction is forward relative to the last state that was active in the document, but backward relative to the last active entry in the session history, what would you do for that?
================================================================================</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>73980</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-09-16 03:56:05 +0000</bug_when>
    <thetext>Ben, any feedback on the question in #2 above?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74054</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-09-18 23:03:59 +0000</bug_when>
    <thetext>Anne, without further info from Ben regarding what he wants, I don&apos;t know what to do here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74641</commentid>
    <comment_count>3</comment_count>
    <who name="Ben Joffe">mail</who>
    <bug_when>2012-09-27 12:27:39 +0000</bug_when>
    <thetext>Hixie: I can&apos;t see the scenario that would lead to what you describe in #2, from what I understand the document history delta should always be the same as the browser history delta. Could you please elaborate?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74712</commentid>
    <comment_count>4</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-09-28 03:41:39 +0000</bug_when>
    <thetext>Ben: Yeah. Consider this case:

 1. User opens a.html.
 2. User clicks a link to b.html.
 3. User clicks a link to b.html#z.
 4. User goes back in one step to a.html, by using the drop-down next to the back button.
 5. User clicks the forward button.

Now b.html gets a forward navigation to its first session history entry, but the last active state of that document was its second session history entry.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74764</commentid>
    <comment_count>5</comment_count>
    <who name="Ben Joffe">mail</who>
    <bug_when>2012-09-28 09:21:00 +0000</bug_when>
    <thetext>Ah I see, thanks.
In that case I guess the value could potentially be defined in two different ways, though I think being defined relative to the document&apos;s last history state has several advantages:

- If the document relies on this property for animations then it will animate in the correct direction for whatever content is flashed on the page to start with.
- Compatibility libraries can provide this property for older browsers, whereas if it&apos;s relative to the browser there won&apos;t be a way to detect the actual delta.
- In your example on step 4, a.html doesn&apos;t need to do any history management, no popstate is fired currently (if I understand correctly), which matches the behaviour of a delta of zero not firing a popstate if this is relative to the document.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79399</commentid>
    <comment_count>6</comment_count>
    <who name="Arthur Stolyar">nekr.fabula</who>
    <bug_when>2012-12-04 12:17:26 +0000</bug_when>
    <thetext>Hello. I read this conversation and have some opinions about this situation. 

May be need just define new attribute of History interface, which indicates the current index of history traversal. For example you can define |currentIndex| attribute which is change right before popstate/hashchange event is fired. So, developer can store previous index of history traversal and compare difference with new |currentIndex| and last |currentIndex|.

Sorry if I have mistakes in my text. I am not native speaker.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79687</commentid>
    <comment_count>7</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-12-07 22:49:05 +0000</bug_when>
    <thetext>If you just want to animate from the current state to the new state, it seems that there&apos;s no need to use a new feature on History. You already know what state you&apos;re currently in, basically by definition. You know what state you&apos;re going to. Just animate between them.

So I don&apos;t understand what this would add.

If I&apos;m missing something, please don&apos;t hesitate to reopen the bug.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>