-
- Reacting to `"visibilitychange"` changes
-
-
- The task source for these tasks is the user
- interaction task source.
-
-
- When the user agent determines that the visibility of the {{Document}}
- of the top-level browsing context has changed, the user agent
- MUST run the following steps:
-
-
- - Let |doc:Document| be the {{Document}} of the top-level browsing
- context.
-
- - If |doc| is now [=Document/visible=]:
-
- - If traversing to a session history entry, run the now
- visible algorithm before running the step to fire the
- [=Window/pageshow=] event.
-
- - Otherwise, queue a task that runs the now visible
- algorithm.
-
-
-
- - Else if |doc| is now not [=Document/visible=], or if the user agent
- is to [=Window/unload=] |doc|:
-
- - If the user agent is to [=Window/unload=] the {{Document}}, run
- the now hidden algorithm during the unloading document
- visibility change steps.
-
- - Otherwise, queue a task that runs the now hidden
- algorithm.
-
-
-
-
-
- The now visible
- algorithm runs the following steps synchronously:
-
-
- - Let |doc:Document| be the {{Document}} of the top-level browsing
- context.
-
- -
- Fire an event named "`visibilitychange`" that bubbles, isn't
- cancelable, and has no default action, at the |doc|.
-
- - Run external now
- visible algorithm if one is defined by another specification.
-
-
-
- The now hidden
- algorithm runs the following steps synchronously:
-
-
- - Let |doc:Document| be the {{Document}} of the top-level browsing
- context.
-
- -
- Fire an event named "`visibilitychange`" that bubbles, isn't
- cancelable, and has no default action, at the |doc|.
-
- - Run external now hidden algorithm if one
- is defined by another specification.
-
-