Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore title passed to pushState()/replaceState() #6482

Merged
merged 3 commits into from
Mar 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 22 additions & 43 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -82738,15 +82738,6 @@ interface <dfn>BarProp</dfn> {
<li><p><dfn data-x="she-serialized-state">serialized state</dfn>, which is <span>serialized
state</span> or null, initially null</p></li>

<li>
<p><dfn data-x="she-title">title</dfn>, a <span>string</span> or null</p>

<p class="note">This need not have any relation with the current <code>title</code> of the <span
data-x="she-document">document</span>. The <span>session history entry</span> <span
data-x="she-title">title</span> is intended to explain the state of the document at that point,
so that the user can navigate the document's history.</p>
</li>

<li><p><dfn data-x="she-scroll-restoration-mode">scroll restoration mode</dfn>, a <span>scroll
restoration mode</span>, initially "<code
data-x="dom-ScrollRestoration-auto">auto</code>".</p></li>
Expand Down Expand Up @@ -82880,8 +82871,8 @@ interface <dfn>History</dfn> {
undefined <span data-x="dom-history-go">go</span>(optional long delta = 0);
undefined <span data-x="dom-history-back">back</span>();
undefined <span data-x="dom-history-forward">forward</span>();
undefined <span data-x="dom-history-pushState">pushState</span>(any data, DOMString title, optional USVString? url = null);
undefined <span data-x="dom-history-replaceState">replaceState</span>(any data, DOMString title, optional USVString? url = null);
undefined <span data-x="dom-history-pushState">pushState</span>(any data, DOMString unused, optional USVString? url = null);
undefined <span data-x="dom-history-replaceState">replaceState</span>(any data, DOMString unused, optional USVString? url = null);
};</code></pre>

<dl class="domintro">
Expand Down Expand Up @@ -82934,18 +82925,20 @@ interface <dfn>History</dfn> {
<p>If there is no next page, does nothing.</p>
</dd>

<dt><var>window</var> . <code data-x="dom-history">history</code> . <code subdfn data-x="dom-history-pushState">pushState</code>(<var>data</var>, <var>title</var> [, <var>url</var> ] )</dt>
<dt><var>window</var> . <code data-x="dom-history">history</code> . <code subdfn data-x="dom-history-pushState">pushState</code>(<var>data</var>, ""[, <var>url</var>])</dt>
domenic marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional: I don't think we typically have a space after (...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It varies a lot... we should try to figure out whatwg/meta#190 at some point :-/

This comment was marked as spam.


<dd>
<p>Pushes the given data onto the session history, with the given title, and, if provided and
not null, the given URL.</p>
<p>Pushes the given data onto the session history, and, if provided and not null, the given URL.
(The second parameter exists for historical reasons, and cannot be omitted; passing the empty
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could link "historical reasons" here and below to https://html5doctor.com/interview-with-ian-hickson-html-editor/ .

string is traditional.)</p>
</dd>

<dt><var>window</var> . <code data-x="dom-history">history</code> . <code subdfn data-x="dom-history-replaceState">replaceState</code>(<var>data</var>, <var>title</var> [, <var>url</var> ] )</dt>
<dt><var>window</var> . <code data-x="dom-history">history</code> . <code subdfn data-x="dom-history-replaceState">replaceState</code>(<var>data</var>, ""[, <var>url</var>])</dt>

<dd>
<p>Updates the current entry in the session history to have the given data, title, and, if
provided and not null, URL.</p>
<p>Updates the current entry in the session history to have the given data, and if provided and
not null, URL. (The second parameter exists for historical reasons, and cannot be omitted;
passing the empty string is traditional.)</p>
</dd>
</dl>

Expand Down Expand Up @@ -83161,8 +83154,7 @@ interface <dfn>History</dfn> {

<p>The <dfn>URL and history update steps</dfn>, given a <code>Document</code> <var>document</var>,
a <span>URL</span> <var>newURL</var>, an optional <span>serialized state</span>-or-null <dfn
data-x="uhus-serializedData"><var>serializedData</var></dfn> (default null), an optional
string-or-null <dfn data-x="uhus-title"><var>title</var></dfn> (default null), and an optional
data-x="uhus-serializedData"><var>serializedData</var></dfn> (default null), and an optional
boolean <dfn data-x="uhus-isPush"><var>isPush</var></dfn> (default false), are:</p>

<ol>
Expand Down Expand Up @@ -83200,8 +83192,6 @@ interface <dfn>History</dfn> {
<li><p><var>serializedData</var> as the <span data-x="she-serialized-state">serialized
state</span>;</p></li>

<li><p><var>title</var> as the <span data-x="she-title">title</span>;</p></li>

<li><p>the <span data-x="she-scroll-restoration-mode">scroll restoration mode</span> of the
current entry in the <span>session history</span> as the <span
data-x="she-scroll-restoration-mode">scroll restoration mode</span>.</p></li>
Expand All @@ -83224,9 +83214,6 @@ interface <dfn>History</dfn> {
<li><p>If <var>serializedData</var> is not null, then set <var>entry</var>'s <span
data-x="she-serialized-state">serialized state</span> to <var>serializedData</var>.</p></li>

<li><p>Set <var>entry</var>'s <span data-x="she-title">title</span> to
<var>title</var>.</p></li>

<li>
<p>Update <var>entry</var> so that it represents a GET request, if it currently represents a
non-GET request (e.g. it was the result of a POST submission).</p>
Expand Down Expand Up @@ -83264,19 +83251,18 @@ interface <dfn>History</dfn> {
</ol>

<p>The <dfn method for="History"><code data-x="dom-history-pushState">pushState(<var>data</var>,
<var>title</var>, <var>url</var>)</code></dfn> method steps are to run the <span>shared history
push/replace state steps</span> given <span>this</span>, <var>data</var>, <var>title</var>,
<var>url</var>, and true.</p>
<var>unused</var>, <var>url</var>)</code></dfn> method steps are to run the <span>shared history
push/replace state steps</span> given <span>this</span>, <var>data</var>, <var>url</var>, and
true.</p>

<p>The <dfn method for="History"><code
data-x="dom-history-replaceState">replaceState(<var>data</var>, <var>title</var>,
data-x="dom-history-replaceState">replaceState(<var>data</var>, <var>unused</var>,
<var>url</var>)</code></dfn> method steps are to run the <span>shared history push/replace state
steps</span> given <span>this</span>, <var>data</var>, <var>title</var>, <var>url</var>, and
false.</p>
steps</span> given <span>this</span>, <var>data</var>, <var>url</var>, and false.</p>

<p>The <dfn>shared history push/replace state steps</dfn>, given a <code>History</code>
<var>history</var>, a value <var>data</var>, a string <var>title</var>, a <span>scalar value
string</span>-or-null <var>url</var>, and a boolean <var>isPush</var>, are:</p>
<var>history</var>, a value <var>data</var>, a <span>scalar value string</span>-or-null
<var>url</var>, and a boolean <var>isPush</var>, are:</p>

<ol>
<li><p>Let <var>document</var> be <var>history</var>'s associated <code>Document</code>.</p></li>
Expand Down Expand Up @@ -83325,13 +83311,10 @@ interface <dfn>History</dfn> {

<li><p>Run the <span>URL and history update steps</span> given <var>document</var> and
<var>newURL</var>, with <i data-x="uhus-serializedData">serializedData</i> set to
<var>serializedData</var>, <i data-x="uhus-title">title</i> set to <var>title</var>, and <i
data-x="uhus-isPush">isPush</i> set to <var>isPush</var>.</p></li>
<var>serializedData</var> and <i data-x="uhus-isPush">isPush</i> set to
<var>isPush</var>.</p></li>
</ol>

<p class="note">The <var>title</var> is purely advisory. User agents might use the title
in the user interface.</p>

<p>User agents may limit the number of state objects added to the session history per page. If a
page hits the <span>implementation-defined</span> limit, user agents must remove the entry
immediately after the first entry for that <code>Document</code> object in the session history
Expand Down Expand Up @@ -83374,7 +83357,7 @@ interface <dfn>History</dfn> {
var currentPage = 5; // prefilled by server
function go(d) {
setupPage(currentPage + d);
history.pushState(currentPage, document.title, '?x=' + currentPage);
history.pushState(currentPage, "", '?x=' + currentPage);
}
onpopstate = function(event) {
setupPage(event.state);
Expand Down Expand Up @@ -83418,7 +83401,7 @@ interface <dfn>History</dfn> {
var i = 1;
function inc() {
set(i+1);
history.pushState(i, 'Line - ' + i);
history.pushState(i, "");
}
function set(newI) {
i = newI;
Expand Down Expand Up @@ -86201,10 +86184,6 @@ new PaymentRequest(&hellip;); // Allowed to use
</ol>
</li>

<li><p>If the <span>current entry</span>'s <span data-x="she-title">title</span> is null, then
set its <span data-x="she-title">title</span> to the value returned by the <code
data-x="dom-document-title">document.title</code> IDL attribute.</p></li>

<li><p><span>Save persisted state</span> to the <span>current entry</span>.</p></li>

<li><p>Let <var>newDocument</var> be <var>entry</var>'s <span
Expand Down