<?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>10365</bug_id>
          
          <creation_ts>2010-08-14 12:19:57 +0000</creation_ts>
          <short_desc>popstate event fires after onload (first page visit) -- intended behavior? would be annoying if there was a script that ajax loaded a page at onpopstate, and hand typing in a url, the page is returned by the server, and then onpopstate fires after onload,</short_desc>
          <delta_ts>2010-11-13 20:31:35 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>pre-LC1 HTML5 spec (editor: Ian Hickson)</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#event-popstate</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>37413</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2010-08-14 12:19:57 +0000</bug_when>
    <thetext>Section: http://www.whatwg.org/specs/web-apps/current-work/#event-popstate

Comment:
popstate event fires after onload (first page visit) -- intended behavior?
would be annoying if there was a script that ajax loaded a page at onpopstate,
and hand typing in a url, the page is returned by the server, and then
onpopstate fires after onload, and the browser/javascript requests the same
page again with ajax.  I think popstate should not fire after onload.  if a
script needs it then they should attach to both onpopstate and onload instead.

Posted from: 219.77.175.157</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>39231</commentid>
    <comment_count>1</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2010-09-24 00:44:28 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;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: Rejected
Change Description: no spec change
Rationale: It only fires after onload if you&apos;ve gone back or forward in the history.

Am I misunderstanding something here? The problem described doesn&apos;t seem to exist.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>41877</commentid>
    <comment_count>2</comment_count>
    <who name="">henry.fai.hang.chan</who>
    <bug_when>2010-10-31 01:52:20 +0000</bug_when>
    <thetext>Firefox and chrome fires onpopstate after onload even without going back/forward.

Is this a spec error or implementation problem?

Should the spec clarify if a page load (just entering into location bar, no back/forward) counts as &quot;navigating to a session history entry&quot;?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>41878</commentid>
    <comment_count>3</comment_count>
      <attachid>930</attachid>
    <who name="">henry.fai.hang.chan</who>
    <bug_when>2010-10-31 01:52:58 +0000</bug_when>
    <thetext>Created attachment 930
test for firing of popstate and onload</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>42007</commentid>
    <comment_count>4</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2010-11-03 07:47:11 +0000</bug_when>
    <thetext>The spec seems completely unambiguous here  search for the string &quot;fire a popstate event&quot; for the only two occurrences, neither of which can happen without history traversal. Regarding the question in comment 2, a page load results in the &quot;navigate&quot; algorithm being invoked, which unambiguously results in history traversal.

Thus what you describe is an implementation bug.

EDITOR&apos;S RESPONSE: This is an Editor&apos;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: Rejected
Change Description: no spec change
Rationale: Not a spec bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>42507</commentid>
    <comment_count>5</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2010-11-13 20:31:35 +0000</bug_when>
    <thetext>The comment in http://code.google.com/p/chromium/issues/detail?id=63040 is right, I made a mistake: popstate will fire after load with a &apos;null&apos; state object, even without going back/forward. I missed that the state object is set to null if history traversal occurs without state (we changed that at some point).

This is as designed, though; the popstate event handler is expected to grab the appropriate data given the provided state object. It&apos;s easy to not grab data if the state is null.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>930</attachid>
            <date>2010-10-31 01:52:58 +0000</date>
            <delta_ts>2010-10-31 01:52:58 +0000</delta_ts>
            <desc>test for firing of popstate and onload</desc>
            <filename>test-popstate.html</filename>
            <type>text/html</type>
            <size>119</size>
            <attacher>henry.fai.hang.chan</attacher>
            
              <data encoding="base64">PHNjcmlwdD4NCndpbmRvdy5vbnBvcHN0YXRlID0gZnVuY3Rpb24oKXthbGVydCgnb25wb3BzdGF0
ZScpfTsNCndpbmRvdy5vbmxvYWQgPSBmdW5jdGlvbigpe2FsZXJ0KCdvbmxvYWQnKX07DQo8L3Nj
cmlwdD4=
</data>

          </attachment>
      

    </bug>

</bugzilla>