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

Add pagereveal event #9818

Merged
merged 15 commits into from
Dec 15, 2023
88 changes: 87 additions & 1 deletion source
Original file line number Diff line number Diff line change
Expand Up @@ -4017,12 +4017,15 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li>The <dfn data-x-href="https://drafts.csswg.org/css-values/#math-function">math functions</dfn></li>
</ul>

<p>The following features are defined in <cite>CSS View Transitions 1</cite>:
<p>The following features are defined in <cite>CSS View Transitions</cite>:
<ref>CSSVIEWTRANSITIONS</ref></p>

<ul class="brief">
domenic marked this conversation as resolved.
Show resolved Hide resolved
<li><dfn data-x-href="https://drafts.csswg.org/css-view-transitions/#perform-pending-transition-operations">perform pending transition operations</dfn></li>
<li><dfn data-x-href="https://drafts.csswg.org/css-view-transitions/#document-rendering-suppression-for-view-transitions">rendering suppression for view transitions</dfn></li>
<li><dfn data-x-href="https://drafts.csswg.org/css-view-transitions/#activate-view-transition">activate view transition</dfn></li>
noamr marked this conversation as resolved.
Show resolved Hide resolved
<li><dfn data-x-href="https://drafts.csswg.org/css-view-transitions/#viewtransition"><code>ViewTransition</code></dfn></li>
<li><dfn data-x-href="https://drafts.csswg.org/css-view-transitions-2/#document-resolve-cross-document-view-transition">resolving cross-document view-transition</dfn></li>
noamr marked this conversation as resolved.
Show resolved Hide resolved
</ul>
noamr marked this conversation as resolved.
Show resolved Hide resolved

<p>The term <dfn data-x="css-styling-attribute"
Expand Down Expand Up @@ -93516,6 +93519,35 @@ dictionary <dfn dictionary>HashChangeEventInit</dfn> : <span>EventInit</span> {
</div>


<h5>The <code>PageRevealEvent</code> interface</h5>

<pre><code class="idl">[Exposed=Window]
interface <dfn interface>PageRevealEvent</dfn> : <span>Event</span> {
constructor(DOMString type, optional <span>PageRevealEventInit</span> eventInitDict = {});
readonly attribute <code>ViewTransition</code>? <span data-x="dom-PageRevealEvent-viewTransition">viewTransition</span>;
};

dictionary <dfn dictionary>PageRevealEventInit</dfn> : <span>EventInit</span> {
<code>ViewTransition</code>? <dfn dict-member for="PageRevealEventInit" data-x="dom-PageRevealEventInit-viewTransition">viewTransition</dfn> = null;
};</code></pre>

<dl class="domintro">
<dt><code data-x=""><var>event</var>.<span subdfn data-x="dom-PageRevealEvent-viewTransition">viewTransition</span></code></dt>
<dd>
<p>Returns the <code>ViewTransition</code> object that represents an inbound cross-document view
transition, if such transition is active when the event is fired. Otherwise, returns null.</p>
</dd>
</dl>

<div w-nodev>

<p>The <dfn attribute for="PageRevealEvent"><code
data-x="dom-PageRevealEvent-viewTransition">viewTransition</code></dfn> attribute must return the
value it was initialized to.</p>

</div>


<h5>The <code>PageTransitionEvent</code> interface</h5>

<pre><code class="idl">[Exposed=Window]
Expand Down Expand Up @@ -100318,6 +100350,8 @@ location.href = '#foo';</code></pre>
<ol>
<li><p>Set <var>document</var>'s <span>page showing</span> flag to true.</p></li>

<li><p>Set <var>document</var>'s <span>has been revealed</span> to false.</p>

<li><p><span>Update the visibility state</span> of <var>document</var> to "<code
data-x="">visible</code>".</p></li>

Expand Down Expand Up @@ -100359,6 +100393,40 @@ location.href = '#foo';</code></pre>
</ol>


<h5>Revealing the document</h5>

<p>A <code>Document</code> has a boolean <dfn>has been revealed</dfn>, initially false. It is used
domenic marked this conversation as resolved.
Show resolved Hide resolved
to ensure that the <code data-x="event-pagereveal">pagereveal</code> event is fired once for each
activation of the <code>Document</code> (once when it's rendered initially, and once for each
<span data-x="reactivate a document">reactivation</span>).</p>

<p>To <dfn>reveal</dfn> a <code>Document</code> <var>document</var>:</p>

<ol>
<li><p>If <var>document</var>'s <span>has been revealed</span> is true, then return.</p></li>
domenic marked this conversation as resolved.
Show resolved Hide resolved

<li><p>Set <var>document</var>'s <span>has been revealed</span> to true.</p></li>

<li><p>Let <var>transition</var> be the result of
<span>resolving cross-document view-transition</span> for <var>document</var>.</p></li>
noamr marked this conversation as resolved.
Show resolved Hide resolved

<li><p><span data-x="concept-event-fire">Fire an event</span> named
<code data-x="event-pagereveal">pagereveal</code> at <var>document</var>'s
<span>relevant global object</span>, using <code>PageRevealEvent</code> with its <code
data-x="dom-PageRevealEvent-viewTransition">viewTransition</code> set to
<var>transition</var>.</p></li>

<li><p>If <var>transition</var> is not null, then <span
data-x="activate view transition">activate</span> <var>transition</var>.</p></li>
</ol>

<p class="note">Though <code data-x="event-pagereveal">pagereveal</code> is guaranteed to be fired
during the first <span>update the rendering</span> step that displays an up-to-date version of the
page, user agents are free to display a cached frame of the page before firing it. This prevents
the presence of a <code data-x="event-pagereveal">pagereveal</code> handler from delaying the
presentation of such cached frame.</p>


<h5>Scrolling to a fragment</h5>

<p>To <dfn id="scroll-to-the-fragment-identifier">scroll to the fragment</dfn> given a
Expand Down Expand Up @@ -107010,6 +107078,9 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
</div>
</li>

<li><p>For each <span>fully active</span> <code>Document</code> in <var>docs</var>,
<span>reveal</span> that <code>Document</code>.</p></li>

<li><p>For each <span>fully active</span> <code>Document</code> in <var>docs</var>, <span>flush
autofocus candidates</span> for that <code>Document</code> if its <span>node navigable</span>
is a <span>top-level traversable</span>.</p></li>
Expand Down Expand Up @@ -108744,6 +108815,7 @@ typedef <span>OnBeforeUnloadEventHandlerNonNull</span>? <dfn typedef>OnBeforeUnl
<tr><td><dfn attribute for="WindowEventHandlers"><code data-x="handler-window-onoffline">onoffline</code></dfn> <td> <code data-x="event-offline">offline</code> <!-- new -->
<tr><td><dfn attribute for="WindowEventHandlers"><code data-x="handler-window-ononline">ononline</code></dfn> <td> <code data-x="event-online">online</code> <!-- new -->
<tr><td><dfn attribute for="WindowEventHandlers"><code data-x="handler-window-onpagehide">onpagehide</code></dfn> <td> <code data-x="event-pagehide">pagehide</code> <!-- new -->
<tr><td><dfn attribute for="WindowEventHandlers"><code data-x="handler-window-onpagereveal">onpagereveal</code></dfn> <td> <code data-x="event-pagereveal">pagereveal</code> <!-- new -->
<tr><td><dfn attribute for="WindowEventHandlers"><code data-x="handler-window-onpageshow">onpageshow</code></dfn> <td> <code data-x="event-pageshow">pageshow</code> <!-- new -->
<tr><td><dfn attribute for="WindowEventHandlers"><code data-x="handler-window-onpopstate">onpopstate</code></dfn> <td> <code data-x="event-popstate">popstate</code> <!-- new -->
<tr><td><dfn attribute for="WindowEventHandlers"><code data-x="handler-window-onrejectionhandled">onrejectionhandled</code></dfn> <td> <code data-x="event-rejectionhandled">rejectionhandled</code>
Expand Down Expand Up @@ -108871,6 +108943,7 @@ interface mixin <dfn interface>WindowEventHandlers</dfn> {
attribute <span>EventHandler</span> <span data-x="handler-window-onoffline">onoffline</span>;
attribute <span>EventHandler</span> <span data-x="handler-window-ononline">ononline</span>;
attribute <span>EventHandler</span> <span data-x="handler-window-onpagehide">onpagehide</span>;
attribute <span>EventHandler</span> <span data-x="handler-window-onpagereveal">onpagereveal</span>;
attribute <span>EventHandler</span> <span data-x="handler-window-onpageshow">onpageshow</span>;
attribute <span>EventHandler</span> <span data-x="handler-window-onpopstate">onpopstate</span>;
attribute <span>EventHandler</span> <span data-x="handler-window-onrejectionhandled">onrejectionhandled</span>;
Expand Down Expand Up @@ -137752,6 +137825,12 @@ interface <dfn interface>External</dfn> {
<td> <code data-x="event-pagehide">pagehide</code> event handler for <code>Window</code> object
<td> <span data-x="event handler content attributes">Event handler content attribute</span>

<tr>
<th id="ix-handler-window-onpagereveal"> <code data-x="">onpagereveal</code>
<td> <code data-x="handler-window-onpagereveal">body</code>
<td> <code data-x="event-pagereveal">pagereveal</code> event handler for <code>Window</code> object
<td> <span data-x="event handler content attributes">Event handler content attribute</span>

<tr>
<th id="ix-handler-window-onpageshow"> <code data-x="">onpageshow</code>
<td> <code data-x="handler-window-onpageshow">body</code>
Expand Down Expand Up @@ -138622,6 +138701,13 @@ INSERT INTERFACES HERE
<td> Fired at the <code>Window</code> when the page's <span>session history entry</span> stops
noamr marked this conversation as resolved.
Show resolved Hide resolved
being the <span data-x="nav-active-history-entry">active entry</span>

<tr> <!-- pagereveal -->
<td> <dfn event for="Window"><code data-x="event-pagereveal">pagereveal</code></dfn>
<td> <code>PageRevealEvent</code>
<td> <code>Window</code>
<td> Fired at the <code>Window</code> when the page begins to render for the first time after
it has been initialized or <span data-x="reactivate a document">reactivated</span>

<tr> <!-- pageshow -->
<td> <dfn event for="Window"><code data-x="event-pageshow">pageshow</code></dfn>
<td> <code>PageTransitionEvent</code>
Expand Down