/
fullscreen.bs
635 lines (449 loc) · 23.8 KB
/
fullscreen.bs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
<pre class=metadata>
Title: Fullscreen API Standard
Group: WHATWG
H1: Fullscreen API
Shortname: fullscreen
Status: LS
No Editor: true
Abstract: The Fullscreen API standard defines an API for elements to display themselves fullscreen.
Logo: https://resources.whatwg.org/logo-fullscreen.svg
Boilerplate: omit feedback-header, omit conformance, omit index, omit idl-index
!Participate: <a href=https://github.com/whatwg/fullscreen>GitHub whatwg/fullscreen</a> (<a href=https://github.com/whatwg/fullscreen/issues/new>file an issue</a>, <a href=https://github.com/whatwg/fullscreen/issues>open issues</a>)
!Participate: <a href=https://wiki.whatwg.org/wiki/IRC>IRC: #whatwg on Freenode</a>
!Commits: <a href=https://github.com/whatwg/fullscreen/commits>GitHub whatwg/fullscreen/commits</a>
!Commits: <a href=https://twitter.com/fullscreenapi>@fullscreenapi</a>
</pre>
<script src=https://resources.whatwg.org/file-issue.js async></script>
<script src=https://resources.whatwg.org/dfn.js defer></script>
<pre class=link-defaults>
spec:dom
type:dfn; for:/; text:element
type:interface; text:Document
</pre>
<pre class=anchors>
urlPrefix: https://w3c.github.io/screen-orientation/#dfn-
type: dfn
text: triggered by a user generated orientation change
</pre>
<pre class=biblio>
{
"CSS": {
"aliasOf": "CSS2"
}
}
</pre>
<h2 id=conformance>Conformance</h2>
<p>All diagrams, examples, and notes in this specification are non-normative, as are all sections
explicitly marked non-normative. Everything else in this specification is normative.
<p>The key words "MUST", "MUST NOT", "REQUIRED", <!--"SHALL", "SHALL NOT",--> "SHOULD", "SHOULD
NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in the normative parts of this specification are to be
interpreted as described in RFC2119. For readability, these words do not appear in all uppercase
letters in this specification. [[!RFC2119]]
<h2 id=terminology>Terminology</h2>
<p>Most terminology used in this specification is from CSS, DOM, HTML, and Web IDL. [[!CSS]]
[[!DOM]] [[!HTML]] [[!WEBIDL]]
<p>The term <dfn>context object</dfn> means the object on which the method or attribute being
discussed was called. When the <a>context object</a> is unambiguous, the term can be omitted.
<p>A <a for=/>browsing context</a> <var>A</var> is called a <dfn>descendant browsing context</dfn>
of a <a for=/>browsing context</a> <var>B</var> if and only if <var>B</var> is an
<a>ancestor browsing context</a> of <var>A</var>.
<h2 id=model>Model</h2>
<p>All <a>elements</a> have an associated <dfn>fullscreen flag</dfn>. Unless stated otherwise it is
unset.
<p>All <{iframe}> <a>elements</a> have an associated <dfn>iframe fullscreen flag</dfn>. Unless
stated otherwise it is unset.
<p>All <a for=/>documents</a> have an associated <dfn>fullscreen element</dfn>. The
<a>fullscreen element</a> is the topmost <a>element</a> in the <a for=/>document</a>'s
<a>top layer</a> whose <a>fullscreen flag</a> is set, if any, and null otherwise.
<p>To <dfn>fullscreen an <var>element</var></dfn>, set <var>element</var>'s <a>fullscreen flag</a>
and <a for="top layer">add</a> it to its <a>node document</a>'s <a>top layer</a>.
<p>To <dfn>unfullscreen an <var>element</var></dfn>, unset <var>element</var>'s
<a>fullscreen flag</a> and <a>iframe fullscreen flag</a> (if any), and <a for="top layer">remove</a>
it from its <a>node document</a>'s <a>top layer</a>.
<p>To <dfn>unfullscreen a <var>document</var></dfn>,
<a lt="unfullscreen an element">unfullscreen</a> all <a>elements</a>, within <var>document</var>'s
<a>top layer</a>, whose <a>fullscreen flag</a> is set.
<hr>
<p>To <dfn>fully exit fullscreen</dfn> a <a for=/>document</a> <var>document</var>, run these steps:
<ol>
<li><p>If <var>document</var>'s <a>fullscreen element</a> is null, terminate these steps.
<li><p><a lt="Unfullscreen an element">Unfullscreen elements</a> whose <a>fullscreen flag</a> is
set, within <var>document</var>'s <a>top layer</a>, except for <var>document</var>'s
<a>fullscreen element</a>.
<li><p><a>Exit fullscreen</a> <var>document</var>.
</ol>
<p>Whenever the <a>removing steps</a> run with an <var>oldNode</var>, run these steps:
<ol>
<li><p>Let <var>nodes</var> be <var>oldNode</var>'s <a>shadow-including inclusive descendants</a>
that have their <a>fullscreen flag</a> set, in <a>shadow-including tree order</a>.
<li>
<p>For each <var>node</var> in <var>nodes</var>, run these substeps:
<ol>
<li><p>If <var>node</var> is its <a>node document</a>'s <a>fullscreen element</a>,
<a>exit fullscreen</a> that <a for=/>document</a>.
<li><p>Otherwise, <a lt="unfullscreen an element">unfullscreen <var>node</var></a> within its
<a>node document</a>.
</ol>
</ol>
<p>Whenever the <a>unloading document cleanup steps</a> run with a <var>document</var>,
<a>fully exit fullscreen</a> <var>document</var>.
<hr>
<p><dfn>Fullscreen is supported</dfn> if there is no previously-established user preference,
security risk, or platform limitation.
<p>An algorithm is <dfn>allowed to request fullscreen</dfn> if one of the following is true:
<ul>
<li><p>The algorithm is <a>triggered by user activation</a>.
<li><p>The algorithm is <a>triggered by a user generated orientation change</a>.
</ul>
<!-- cross-process -->
<h2 id=api>API</h2>
<pre class=idl>
partial interface Element {
Promise<void> requestFullscreen();
};
partial interface Document {
[LenientSetter] readonly attribute boolean fullscreenEnabled;
[LenientSetter] readonly attribute boolean fullscreen; // historical
Promise<void> exitFullscreen();
attribute EventHandler onfullscreenchange;
attribute EventHandler onfullscreenerror;
};
partial interface DocumentOrShadowRoot {
[LenientSetter] readonly attribute Element? fullscreenElement;
};
</pre>
<dl class=domintro>
<dt><code><var>promise</var> = <var>element</var> . {{Element/requestFullscreen()}}</code>
<dd><p>Displays <var>element</var> fullscreen and fulfills <var>promise</var> when done.
<dt><code><var>document</var> . {{Document/fullscreenEnabled}}</code>
<dd><p>Returns true if <var>document</var> has the ability to display <a>elements</a> fullscreen
and <a>fullscreen is supported</a>, or false otherwise.
<dt><code><var>promise</var> = <var>document</var> . {{Document/exitFullscreen()}}</code>
<dd><p>Stops <var>document</var>'s <a>fullscreen element</a> from being displayed fullscreen and
fulfills <var>promise</var> when done.
<dt><code><var>document</var> . {{DocumentOrShadowRoot/fullscreenElement}}</code>
<dd><p>Returns <var>document</var>'s <a>fullscreen element</a>.
<dt><code><var>shadowroot</var> . {{DocumentOrShadowRoot/fullscreenElement}}</code>
<dd><p>Returns <var>shadowroot</var>'s <a>fullscreen element</a>.
</dl>
<p>A <dfn>fullscreen element ready check</dfn> for an <a>element</a> <var>element</var> returns true
if all of the following are true, and false otherwise:
<ul>
<li><p><var>element</var> is <a>connected</a>.
<li><p><var>element</var>'s <a>node document</a> is <a>allowed to use</a> the feature indicated by
attribute name <code>allowfullscreen</code>.
<!-- cross-process, recursive -->
</ul>
<p>The <dfn method for=Element><code>requestFullscreen()</code></dfn> method, when invoked, must run
these steps:
<ol>
<li><p>Let <var>pending</var> be the <a>context object</a>.
<li><p>Let <var>error</var> be false.
<li><p>Let <var>promise</var> be a new promise.
<li>
<p>If any of the following conditions are false, then set <var>error</var> to true:
<ul>
<li><p><var>pending</var>'s <a for=Element>namespace</a> is the <a>HTML namespace</a> or
<var>pending</var> is an
<a href=https://www.w3.org/TR/SVG11/struct.html#SVGElement>SVG <code>svg</code></a> or
<a href=https://www.w3.org/Math/draft-spec/chapter2.html#interf.toplevel>MathML <code>math</code></a>
element. [[!SVG]] [[!MATHML]]
<li><p>The <a>fullscreen element ready check</a> for <var>pending</var> returns true.
<li><p><a>Fullscreen is supported</a>.
<li><p>This algorithm is <a>allowed to request fullscreen</a>.
</ul>
<li><p>Return <var>promise</var>, and run the remaining steps <a>in parallel</a>.
<li><p>If <var>error</var> is false: Resize <var>pending</var>'s
<a>top-level browsing context</a>'s <a>active document</a>'s viewport's dimensions to match the
dimensions of the screen of the output device. Optionally display a message how the end user can
revert this.
<!-- cross-process -->
<li>
<p>As part of the next <a>animation frame task</a>, run these substeps:
<ol>
<li><p>If either <var>error</var> is true or the <a>fullscreen element ready check</a> for
<var>pending</var> returns false, <a>fire an event</a> named <code>fullscreenerror</code> on
<var>pending</var>'s <a>node document</a>, reject <var>promise</var> with a
<code>TypeError</code> exception, and terminate these steps.
<!-- cross-process; check is only needed on pending as it is recursive already -->
<li><p>Let <var>fullscreenElements</var> be an ordered set initially consisting of
<var>pending</var>.
<li><p>While the first element in <var>fullscreenElements</var> is in a
<a>nested browsing context</a>, prepend its <a>browsing context container</a> to
<var>fullscreenElements</var>.
<!-- cross-process -->
<li><p>Let <var>eventDocs</var> be an empty list.
<li>
<p>For each <var>element</var> in <var>fullscreenElements</var>, in order, run these
subsubsteps:
<ol>
<li><p>Let <var>doc</var> be <var>element</var>'s <a>node document</a>.
<li>
<p>If <var>element</var> is <var>doc</var>'s <a>fullscreen element</a>, terminate these
subsubsteps.
<p class=note>No need to notify observers when nothing has changed.
<li><p>Otherwise, append <var>doc</var> to <var>eventDocs</var>.
<li><p>If <var>element</var> is <var>pending</var> and <var>pending</var> is an <{iframe}>
<a>element</a>, then set <var>element</var>'s <a>iframe fullscreen flag</a>.
<li><p><a lt="Fullscreen an element">Fullscreen <var>element</var></a> within <var>doc</var>.
</ol>
<li><p>For each <var>doc</var> in <var>eventDocs</var>, in order, <a>fire an event</a> named
<code>fullscreenchange</code> on <var>doc</var>.
<li><p>Fulfill <var>promise</var> with undefined.
</ol>
<p class=XXX><dfn>Animation frame task</dfn> is not really defined yet, including relative order
within that task, see <a href=https://www.w3.org/Bugs/Public/show_bug.cgi?id=26440>bug 26440</a>.
<p class=note>Implementations with out-of-process <a for=/>browsing contexts</a> are left as an
exercise to the reader. Input welcome on potential improvements.
</ol>
<p>The <dfn attribute for=Document><code>fullscreenEnabled</code></dfn> attribute's getter must
return true if the <a>context object</a> is <a>allowed to use</a> the feature indicated by attribute
name <code>allowfullscreen</code> and <a>fullscreen is supported</a>, and false otherwise.
<p>The <dfn attribute for=Document><code>fullscreen</code></dfn> attribute's getter must return
false if <a>context object</a>'s <a>fullscreen element</a> is null, and true otherwise.
<p class=note>Use the {{DocumentOrShadowRoot/fullscreenElement}} attribute instead.
<p>The
<dfn attribute for=DocumentOrShadowRoot id=dom-document-fullscreenelement><code>fullscreenElement</code></dfn>
attribute's getter must run these steps:
<ol>
<li><p>If the <a>context object</a> is a <a for=/>shadow root</a> and its
<a for=DocumentFragment>host</a> is not <a>connected</a>, then return null.</li>
<li><p>Let <var>candidate</var> be the result of <a>retargeting</a> <a>fullscreen element</a>
against the <a>context object</a>.
<li><p>If <var>candidate</var> and the <a>context object</a> are in the same <a>tree</a>, then
return <var>candidate</var>.
<li><p>Return null.
</ol>
<p>To <dfn>collect documents to unfullscreen</dfn> given <var>doc</var>, run these steps:
<ol>
<li><p>If <var>doc</var>'s <a>top layer</a> consists of more than a single <a>element</a> that has
its <a>fullscreen flag</a> set, return the empty set.
<li><p>Let <var>docs</var> be an ordered set consisting of <var>doc</var>.
<li><p>While <var>docs</var>'s last <a for=/>document</a> has a <a>browsing context container</a>
whose <a>node document</a>'s <a>top layer</a> consists of a single <a>element</a> that has its
<a>fullscreen flag</a> set and does not have its <a>iframe fullscreen flag</a> set (if any), append
that <a>node document</a> to <var>docs</var>.
<li><p>Return <var>docs</var>.
</ol>
<p>To <dfn>exit fullscreen</dfn> a <a for=/>document</a> <var>doc</var>, run these steps:
<ol>
<li><p>Let <var>promise</var> be a new promise.
<li><p>If <var>doc</var>'s <a>fullscreen element</a> is null, reject <var>promise</var> with a
<code>TypeError</code> exception, and return <var>promise</var>.
<li><p>Let <var>resize</var> be false.
<li><p>Let <var>docs</var> be the result of
<a lt="collect documents to unfullscreen">collecting documents to unfullscreen</a> given
<var>doc</var>.
<!-- cross-process -->
<li><p>Let <var>topLevelDoc</var> be <var>doc</var>'s <a>top-level browsing context</a>'s
<a>active document</a>.
<!-- cross-process -->
<li><p>If <var>topLevelDoc</var> is in <var>docs</var>, then set <var>resize</var> to true.
<li><p>Return <var>promise</var>, and run the remaining steps <a>in parallel</a>.
<li><p>If <var>resize</var> is true, resize <var>topLevelDoc</var>'s viewport to its "normal"
dimensions.
<li>
<p>As part of the next <a>animation frame task</a>, run these substeps:
<ol>
<li><p>Let <var>exitDocs</var> be the result of
<a lt="collect documents to unfullscreen">collecting documents to unfullscreen</a> given
<var>doc</var>.
<!-- cross-process -->
<li><p>If <var>resize</var> is true and <var>topLevelDoc</var> is not in <var>exitDocs</var>,
<a>fully exit fullscreen</a> <var>topLevelDoc</var>, reject <var>promise</var> with a
<code>TypeError</code> exception, and terminate these steps.
<li><p>If <var>exitDocs</var> is the empty set, append <var>doc</var> to <var>exitDocs</var>.
<li><p>If <var>exitDocs</var>'s last <a for=/>document</a> has a
<a>browsing context container</a>, append that <a>browsing context container</a>'s
<a>node document</a> to <var>exitDocs</var>.
<!-- cross-process -->
<li><p>Let <var>descendantDocs</var> be an ordered set consisting of <var>doc</var>'s
<a>descendant browsing contexts</a>' <a>active documents</a> whose <a>fullscreen element</a> is
non-null, if any, in <em>reverse</em> <a>tree order</a>.
<!-- cross-process -->
<li><p>For each <var>descendantDoc</var> in <var>descendantDocs</var>, in order,
<a lt="unfullscreen a document">unfullscreen <var>descendantDoc</var></a>.
<!-- cross-process -->
<li><p>For each <var>exitDoc</var> in <var>exitDocs</var>, in order,
<a lt="unfullscreen an element">unfullscreen</a> <var>exitDoc</var>'s <a>fullscreen element</a>.
<li><p>For each <var>descendantDoc</var> in <var>descendantDocs</var>, in order,
<a>fire an event</a> named <code>fullscreenchange</code> on <var>descendantDoc</var>.
<!-- cross-process -->
<li><p>For each <var>exitDoc</var> in <var>exitDocs</var>, in order, <a>fire an event</a> named
<code>fullscreenchange</code> on <var>exitDoc</var>.
<!-- cross-process -->
<li><p>Fulfill <var>promise</var> with undefined.
</ol>
<p class=note>This results in events being fired from the innermost to the outermost document.
</ol>
<p>The <dfn method for=Document><code>exitFullscreen()</code></dfn> method, when invoked, must
return the result of running <a>exit fullscreen</a> on the <a>context object</a>.
<hr>
<p>The following are the <a>event handlers</a> (and their corresponding
<a>event handler event types</a>) that must be supported on <a for=/>documents</a> as attributes:
<table>
<thead>
<tr>
<th><a lt="event handlers">event handler</a>
<th><a>event handler event type</a>
<tbody>
<tr>
<td><dfn attribute for=Document id=handler-document-onfullscreenchange><code>onfullscreenchange</code></dfn>
<td><code>fullscreenchange</code>
<tr>
<td><dfn attribute for=Document id=handler-document-onfullscreenerror><code>onfullscreenerror</code></dfn>
<td><code>fullscreenerror</code>
</table>
<h2 id=ui>UI</h2>
<p>User agents are encouraged to implement native media fullscreen controls in terms of
{{Element/requestFullscreen()}} and {{Document/exitFullscreen()}}.
<p>If the end user instructs the user agent to end a fullscreen session initiated via
{{Element/requestFullscreen()}}, <a>fully exit fullscreen</a> the
<a>top-level browsing context</a>'s <a>active document</a>.
<h2 id=rendering>Rendering</h2>
<p>This section is to be interpreted equivalently to the Rendering section of HTML. [[!HTML]]
<p class=XXX>Long term CSS will define the <a>top layer</a> concept and its associated
<a><code>::backdrop</code></a> pseudo-element as part of CSS' stacking context model. Patching CSS
as done here is sketchy as hell.
<h3 id=new-stacking-layer>New stacking layer</h3>
<p>This specification introduces a new stacking layer to the
<a href=https://www.w3.org/TR/CSS2/zindex.html>Elaborate description of Stacking Contexts</a> of CSS
2.1. It is called the <dfn export>top layer</dfn>, comes after step 10 in the painting order, and is
therefore rendered closest to the user within a viewport. Each <a for=/>document</a> has one
associated viewport and therefore also one <a>top layer</a>. [[!CSS]]
<p class=note>The terminology used in this and following subsection attempts to match CSS 2.1
Appendix E.
<p>The <a>top layer</a> consists of an ordered set of elements, rendered in the order they have been
added to the set. The last element added is rendered closest to the user.
<p class=note>The <code>z-index</code> property has no effect in the <a>top layer</a>.
<p>Each element and <a><code>::backdrop</code></a> pseudo-element in a <a>top layer</a> has the
following characteristics:
<ul>
<li><p>It generates a new stacking context.
<li><p>Its parent stacking context is the root stacking context.
<li><p>If it consists of multiple layout boxes, the first box is used.
<!-- https://www.w3.org/Bugs/Public/show_bug.cgi?id=24523 -->
<li>
<p>It is rendered as an atomic unit as if it were a sibling of its <a for=tree>root</a>.
<p class=note><a for=tree>Ancestor</a> elements with overflow, opacity, masks, etc. cannot affect
it.
<li><p>If its <code>position</code> property computes to <code>fixed</code>, its containing block
is the viewport, and the initial containing block otherwise.
<li><p>If it is an element, it and its <a><code>::backdrop</code></a> pseudo-element are not
rendered if its <a>shadow-including inclusive ancestor</a> has the <code>display</code> property
set to <code>none</code>.
<li><p>If its specified <code>display</code> property is <code>contents</code>, it computes to
<code>block</code>.
<li><p>If its specified <code>position</code> property is not <code>absolute</code> or
<code>fixed</code>, it computes to <code>absolute</code>.
<li><p>Its outline, if any, is to be rendered before step 10 in the painting order.
<li><p>Unless overridden by another specification, its static position for <code>left</code>,
<code>right</code>, and <code>top</code> is zero.
</ul>
<p>To <dfn export for="top layer">add</dfn> an <var>element</var> to a <var>top layer</var>, add, or
move if already present, <var>element</var> on top of <var>top layer</var>.
<p>To <dfn export for="top layer">remove</dfn> an <var>element</var> from a <var>top layer</var>,
remove <var>element</var> from <var>top layer</var>.
<h3 id=::backdrop-pseudo-element><code>::backdrop</code> pseudo-element</h3>
<p>Each element in a <a>top layer</a> has a
<dfn id=css-pe-backdrop selector><code>::backdrop</code></dfn> pseudo-element. This pseudo-element
is a box rendered immediately below the element (and above the element before the element in the
set, if any), within the same <a>top layer</a>.
<p class=note>The <a><code>::backdrop</code></a> pseudo-element can be used to create a backdrop
that hides the underlying document for an element in a <a>top layer</a> (such as an element that is
displayed fullscreen).
<p>It does not inherit from any element and is not inherited from. No restrictions are made on what
properties apply to this pseudo-element either.
<!-- That this is not in a more normative prose is because CSS should have hooks for this stuff
which make it normative. -->
<h3 id=:fullscreen-pseudo-class><code>:fullscreen</code> pseudo-class</h3>
<p>The <dfn id=css-pc-fullscreen selector><code>:fullscreen</code></dfn> pseudo-class must match any
<a>element</a> <var>element</var> for which one of the following conditions is true:
<ul>
<li><p><var>element</var>'s <a>fullscreen flag</a> is set.
<li><p><var>element</var> is a <a>shadow host</a> and the result of <a>retargeting</a> its
<a>node document</a>'s <a>fullscreen element</a> against <var>element</var> is <var>element</var>.
</ul>
<p class="note no-backref">This makes it different from the
{{DocumentOrShadowRoot/fullscreenElement}} API, which returns the topmost <a>fullscreen element</a>.
<h3 id=user-agent-level-style-sheet-defaults>User-agent level style sheet defaults</h3>
<!-- HTML's "The CSS user agent style sheet and presentational hints" section uses this term -->
<pre class=css>
@namespace "http://www.w3.org/1999/xhtml";
*|*:not(:root):fullscreen {
position:fixed !important;
top:0 !important; right:0 !important; bottom:0 !important; left:0 !important;
margin:0 !important;
box-sizing:border-box !important;
min-width:0 !important;
max-width:none !important;
min-height:0 !important;
max-height:none !important;
width:100% !important;
height:100% !important;
transform:none !important;
/* intentionally not !important */
object-fit:contain;
}
iframe:fullscreen {
border:none !important;
padding:0 !important;
}
::backdrop {
position:fixed;
top:0; right:0; bottom:0; left:0;
}
*|*:not(:root):fullscreen::backdrop {
background:black;
}
</pre>
<h2 id=security-and-privacy-considerations>Security and Privacy Considerations</h2>
<p>User agents should ensure, e.g. by means of an overlay, that the end user is aware something is
displayed fullscreen. User agents should provide a means of exiting fullscreen that always works and
advertise this to the user. This is to prevent a site from spoofing the end user by recreating the
user agent or even operating system environment when fullscreen. See also the definition of
{{Element/requestFullscreen()}}.
<p>To enable content in a <a>nested browsing context</a> to go fullscreen, it needs to be
specifically allowed via the <code>allowfullscreen</code> attribute of the HTML <{iframe}> element.
This prevents e.g. content from third parties to go fullscreen without explicit permission.
<div data-fill-with=references></div>
<h2 id=acknowledgments class=no-num>Acknowledgments</h2>
<p>Many thanks to Robert O'Callahan for designing the initial model and being awesome.
<!-- https://wiki.mozilla.org/Gecko:FullScreenAPI -->
<p>Thanks to
Andy Earnshaw,
Chris Pearce,
Darin Fisher,
<i>fantasai</i>,
Giuseppe Pascale,
Glenn Maynard,
Ian Hickson,
Ignacio Solla,
João Eiras,
Josh Soref,
Matt Falkenhagen,
Mihai Balan,
Mounir Lamouri,
Øyvind Stenhaug,
Pat Ladd,
Philip Jägenstedt,
Rafał Chłodnicki,
Riff Jiang,
Rune Lillesveen,
Sigbjørn Vik,
Simon Pieters,
Tab Atkins,
Takayoshi Kochi,
Theresa O'Connor,
Vincent Scheib, and
Xidorn Quan
for also being awesome.
<p>This standard is written by <a lang=nl href=https://annevankesteren.nl/>Anne van Kesteren</a>
(<a href=https://www.mozilla.org/>Mozilla</a>,
<a href=mailto:annevk@annevk.nl>annevk@annevk.nl</a>).
<a lang=tr href=http://tantek.com/>Tantek Çelik</a>
(<a class="p-org org h-org h-card" href=https://www.mozilla.org/>Mozilla</a>,
<a href=mailto:tantek@cs.stanford.edu>tantek@cs.stanford.edu</a>) sorted out legal hassles.
<p>Per <a rel=license href=https://creativecommons.org/publicdomain/zero/1.0/>CC0</a>, to the extent
possible under law, the editor has waived all copyright and related or neighboring rights to this
work.