W3C home > Mailing lists > Public > public-html-diffs@w3.org > November 2009

hixie: Explain pushState()'s title better. (whatwg r4376)

From: poot <cvsmail@w3.org>
Date: Tue, 24 Nov 2009 10:02:25 +0900 (JST)
To: public-html-diffs@w3.org
Message-Id: <20091124010226.158F02BC32@toro.w3.mag.keio.ac.jp>
hixie: Explain pushState()'s title better. (whatwg r4376)

http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.3508&r2=1.3509&f=h
http://html5.org/tools/web-apps-tracker?from=4375&to=4376

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.3508
retrieving revision 1.3509
diff -u -d -r1.3508 -r1.3509
--- Overview.html	13 Nov 2009 01:45:09 -0000	1.3508
+++ Overview.html	24 Nov 2009 01:02:08 -0000	1.3509
@@ -215,7 +215,7 @@
    <h1>HTML5</h1>
    <h2 class="no-num no-toc" id="a-vocabulary-and-associated-apis-for-html-and-xhtml">A vocabulary and associated APIs for HTML and XHTML</h2>
 
-   <h2 class="no-num no-toc" id="editor-s-draft-13-november-2009">Editor's Draft 13 November 2009</h2>
+   <h2 class="no-num no-toc" id="editor-s-draft-24-november-2009">Editor's Draft 24 November 2009</h2>
    <dl><dt>Latest Published Version:</dt>
     <dd><a href="http://www.w3.org/TR/html5/">http://www.w3.org/TR/html5/</a></dd>
     <dt>Latest Editor's Draft:</dt>
@@ -313,7 +313,7 @@
   specification's progress along the W3C Recommendation
   track.
 
-  This specification is the 13 November 2009 Editor's Draft.
+  This specification is the 24 November 2009 Editor's Draft.
   </p><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- relationship to other work (required) --><p>This specification is also being produced by the <a href="http://www.whatwg.org/">WHATWG</a>. The two specifications are
   identical from the table of contents onwards.</p><!-- UNDER NO CIRCUMSTANCES IS THE FOLLOWING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- context and rationale (required) --><p>This specification is intended to replace (be a new version of)
   what was previously the HTML4, XHTML1, and DOM2 HTML
@@ -46700,7 +46700,13 @@
   <p class="note">This does not imply that the user interface need be
   linear. See the <a href="#history-notes">notes below</a>.</p>
 
-  </div><p>URLs without associated <a href="#state-object" title="state object">state
+  </div><p class="note">Titles associated with <a href="#session-history-entry" title="session history
+  entry">session history entries</a> need not have any relation
+  with the current <code><a href="#the-title-element-0">title</a></code> of the
+  <code>Document</code>. The title of a <a href="#session-history-entry">session history
+  entry</a> is intended to explain the state of the document at
+  that point, so that the user can navigate the document's
+  history.<p>URLs without associated <a href="#state-object" title="state object">state
   objects</a> are added to the session history as the user (or
   script) navigates from page to page.<p>A <dfn id="state-object">state object</dfn> is an object representing a user
   interface state.<p>Pages can <a href="#dom-history-pushstate" title="dom-history-pushState">add</a> <a href="#state-object" title="state object">state objects</a> between their entry in the
@@ -47027,6 +47033,35 @@
    more convenient form, so that the script doesn't have to parse the
    URL each time the user navigates.</p>
 
+  </div><div class="example">
+
+   <p>Applications might not use the same title for a <a href="#session-history-entry">session
+   history entry</a> as the value of the document's
+   <code><a href="#the-title-element-0">title</a></code> element at that time. For example, here is a
+   simple page that shows a block in the <code><a href="#the-title-element-0">title</a></code> element.
+   Clearly, when navigating backwards to a previous state the user
+   does not go back in time, and therefore it would be inappropriate
+   to put the time in the session history title.</p>
+
+   <pre>&amp;l;t!DOCTYPE HTML&gt; 
+&amp;l;tTITLE&gt;Line&amp;l;t/TITLE&gt;
+&amp;l;tSCRIPT&gt;
+ setInterval(function () { document.title = 'Line - ' + new Date(); }, 1000);
+ var i = 1;
+ function inc() {
+   set(i+1);
+   history.pushState(i, 'Line - ' + i);
+ }
+ function set(newI) {
+   i = newI;
+   document.forms.F.I.value = newI;
+ }
+&amp;l;t/SCRIPT&gt;
+&amp;l;tBODY ONPOPSTATE="recover(event.state)"&gt;
+&amp;l;tFORM NAME=F&gt;
+State: &amp;l;tOUTPUT NAME=I&gt;1&amp;l;t/OUTPUT&gt; &amp;l;tINPUT VALUE="Increment" TYPE=BUTTON ONCLICK="inc()"&gt;
+&amp;l;t/FORM&gt;</pre>
+
   </div><h4 id="activating-state-object-entries"><span class="secno">6.10.3 </span><dfn title="activate the state object">Activating state object entries</dfn></h4><p class="XXX annotation"><b>Status: </b><i>Last call for comments</i><div class="impl">
 
   <p>When an entry in the session history is activated (which happens
Received on Tuesday, 24 November 2009 01:02:54 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 18 December 2010 06:14:16 GMT