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

Fire "visibilitychange" events explicitly #7153

Merged
merged 9 commits into from
Oct 15, 2021
Merged
Changes from 8 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
59 changes: 30 additions & 29 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -9314,6 +9314,7 @@ partial interface <dfn id="document" data-lt="">Document</dfn> {

// special <span>event handler IDL attributes</span> that only apply to Document objects
[<span>LegacyLenientThis</span>] attribute <span>EventHandler</span> <span data-x="handler-onreadystatechange">onreadystatechange</span>;
attribute <span>EventHandler</span> <span data-x="handler-onvisibilitychange">onvisibilitychange</span>;

// <a href="#Document-partial">also has obsolete members</a>
};
Expand Down Expand Up @@ -88419,13 +88420,9 @@ new PaymentRequest(&hellip;); // Allowed to use

<li><p>Set <var>newDocument</var>'s <span>page showing</span> flag to true.</p></li>

<li>
<p>Run any <dfn>session history document visibility change steps</dfn> for
<var>newDocument</var> that are defined by <span>other applicable specifications</span>.</p>

<p class="note">This is specifically intended for use by <cite>Page Visibility</cite>. <ref
spec=PAGEVIS></p>
</li>
<li><p>Fire an event named <code data-x="event-visibilitychange">visibilitychange</code> at
<var>newDocument</var>, with its <code data-x="dom-Event-bubbles">bubbles</code> attribute
initialized to true.</p></li>

<li><p><span>Fire a page transition event</span> named <code
data-x="event-pageshow">pageshow</code> at <var>newDocument</var>'s <span>relevant global
Expand Down Expand Up @@ -88878,40 +88875,36 @@ dictionary <dfn dictionary>PageTransitionEventInit</dfn> : <span>EventInit</span

<li><p>Increase <var>document</var>'s <span>unload counter</span> by 1.</p></li>

<li><p>If <var>document</var>'s <span>page showing</span> flag is false, then jump to the
step labeled <i>unload event</i> below (i.e. skip firing the <code
data-x="event-pagehide">pagehide</code> event and don't rerun the <span>unloading document
visibility change steps</span>).</p></li>

<li><p>Set <var>document</var>'s <span>page showing</span> flag to false.</p></li>

<li><p>If the user agent does not intend to keep <var>document</var> alive
in a <span>session history entry</span> (such that it can be reused later on <span
data-x="traverse the history">history traversal</span>), set <var>document</var>'s
<i data-x="concept-document-salvageable">salvageable</i> state to false.</p></li>

<li><p><span>Fire a page transition event</span> named <code
data-x="event-pagehide">pagehide</code> at <var>document</var>'s <span>relevant global
object</span> with <var>document</var>'s <i data-x="concept-document-salvageable">salvageable</i>
state.</p></li>

<li>
<p>Run any <dfn>unloading document visibility change steps</dfn> for <var>document</var> that
are defined by <span>other applicable specifications</span>.</p>
<p>If <var>document</var>'s <span>page showing</span> flag is true:</p>

<p class="note">This is specifically intended for use by <cite>Page Visibility</cite>.
<ref spec=PAGEVIS></p>
</li>
<ol>
<li><p>Set <var>document</var>'s <span>page showing</span> flag to false.</p></li>
Copy link
Member

Choose a reason for hiding this comment

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

This is two-space indents, but it should be 1-space.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed


<li><p><span>Fire a page transition event</span> named <code
data-x="event-pagehide">pagehide</code> at <var>document</var>'s
<span>relevant global object</span> with <var>document</var>'s
<i data-x="concept-document-salvageable">salvageable</i> state.</p></li>

<li><p>Fire an event named <code data-x="event-visibilitychange">visibilitychange</code> at
<var>newDocument</var>, with its <code data-x="dom-Event-bubbles">bubbles</code> attribute
initialized to true.</p></li>
</ol>
</li>

<li><p>If <var>unloadTimingInfo</var> is not null, then set <var>unloadTimingInfo</var>'s
<span>unload event start time</span> to the <span>current high resolution time</span> given
<var>document</var>'s <span>relevant global object</span>.</p></li>

<li><p><i>Unload event</i>: If <var>document</var>'s <i
data-x="concept-document-salvageable">salvageable</i> state is false, then <span
data-x="concept-event-fire">fire an event</span> named <code data-x="event-unload">unload</code>
at <var>document</var>'s <span>relevant global object</span>, with <var>legacy target override
flag</var> set.</p></li>
<li><p>If <var>document</var>'s <i data-x="concept-document-salvageable">salvageable</i> state is
false, then <span data-x="concept-event-fire">fire an event</span> named
<code data-x="event-unload">unload</code> at <var>document</var>'s
<span>relevant global object</span>, with <var>legacy target override flag</var> set.</p></li>

<li><p>If <var>unloadTimingInfo</var> is not null, then set <var>unloadTimingInfo</var>'s
<span>unload event end time</span> to the <span>current high resolution time</span> given
Expand Down Expand Up @@ -95096,6 +95089,7 @@ typedef <span>OnBeforeUnloadEventHandlerNonNull</span>? <dfn typedef>OnBeforeUnl
<tr><th><span data-x="event handlers">Event handler</span> <th><span>Event handler event type</span>
<tbody>
<tr><td><dfn attribute for="Document"><code data-x="handler-onreadystatechange">onreadystatechange</code></dfn> <td> <code data-x="event-readystatechange">readystatechange</code>
<tr><td><dfn attribute for="Document"><code data-x="handler-onvisibilitychange">onvisibilitychange</code></dfn> <td> <code data-x="event-visibilitychange">visibilitychange</code>
</table>


Expand Down Expand Up @@ -125552,6 +125546,13 @@ INSERT INTERFACES HERE
<td> <code>Window</code>
<td> Fired at the <code>Window</code> object when the page is going away

<tr> <!-- visibilitychange -->
<td> <dfn event for="Document"><code data-x="event-visibilitychange">visibilitychange</code></dfn>
<td> <code>Event</code>
<td> <code>Document</code>
<td> Fired at the <code>Document</code> object when the page becomes visible or hidden to the
Copy link
Member

Choose a reason for hiding this comment

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

This will just produce the literal text [[PAGEVIS]] in the output. In HTML you need to use <ref spec=PAGEVIS>. (And, if you do that, you need to not delete the reference on line 126072.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

user. <ref spec=PAGEVIS>

</table>

<p class="note">See also <a href="#mediaevents">media element events</a> and <a
Expand Down