-
Notifications
You must be signed in to change notification settings - Fork 708
/
Copy pathOverview.html
2089 lines (1711 loc) · 149 KB
/
Overview.html
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
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html><html lang="en-US"><head>
<meta charset="utf-8">
<title>CSSOM View Module</title>
<style>
.propdef { font:inherit; line-height:2.3 }
</style>
<link href="../default.css" rel="stylesheet">
<link href="https://www.w3.org/StyleSheets/TR/W3C-ED" rel="stylesheet">
</head>
<body class="draft">
<div class="head">
<!--begin-logo-->
<p><a href="http://www.w3.org/"><img alt="W3C" height="48" src="https://www.w3.org/Icons/w3c_home" width="72"></a></p>
<!--end-logo-->
<h1>CSSOM View Module</h1>
<h2 class="no-num no-toc" id="w3c-doctype">Editor's Draft 2 December 2014</h2>
<dl>
<dt>This Version:</dt>
<dd class="dontpublish"><a href="http://dev.w3.org/csswg/cssom-view/">http://dev.w3.org/csswg/cssom-view/</a></dd>
<dt class="dontpublish">Participate:</dt>
<dd class="dontpublish"><a href="mailto:www-style@w3.org?subject=%5Bcssom-view%5D%20">www-style@w3.org</a>
(<a href="http://lists.w3.org/Archives/Public/www-style/">archives</a>)
<dd class="dontpublish"><a href="https://www.w3.org/Bugs/Public/enter_bug.cgi?product=CSS&component=CSSOM%20View">File a bug</a>
(<a href="https://www.w3.org/Bugs/Public/buglist.cgi?component=CSSOM%20View&product=CSS&resolution=---">open bugs</a>)
<script async="" src="http://resources.whatwg.org/file-bug.js"></script>
<dd class="dontpublish"><a href="irc://irc.w3.org:6665/css">IRC: #css on W3C</a></dd>
<dt>Previous Versions:</dt>
<dd><a href="http://www.w3.org/TR/2009/WD-cssom-view-20090804/">http://www.w3.org/TR/2009/WD-cssom-view-20090804/</a></dd>
<dd><a href="http://www.w3.org/TR/2008/WD-cssom-view-20080222/">http://www.w3.org/TR/2008/WD-cssom-view-20080222/</a></dd>
<dd><a href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/">http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/</a></dd>
<dt>Editors:</dt>
<dd>Simon Pieters
(<a href="http://www.opera.com/">Opera Software ASA</a>)
<<a href="mailto:simonp@opera.com">simonp@opera.com</a>></dd>
<dd><a href="http://www.w3.org/wiki/User:Gadams">Glenn Adams</a>
(<a href="http://www.cox.com/">Cox Communications, Inc.</a>)
<<a href="mailto:glenn.adams@cox.com">glenn.adams@cox.com</a>></dd>
<dt>Previous Editor:</dt>
<dd><a href="http://annevankesteren.nl/">Anne van Kesteren</a>
(<a href="http://www.opera.com/">Opera Software ASA</a>)
<<a href="mailto:annevk@annevk.nl">annevk@annevk.nl</a>></dd>
</dl>
<!--begin-copyright-->
<p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2014 <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href="http://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>), All Rights Reserved. W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.</p>
<!--end-copyright-->
</div>
<hr>
<h2 class="no-num no-toc" id="abstract">Abstract</h2>
<p>The APIs introduced by this specification provide authors with a way to
inspect and manipulate the visual view of a document. This includes
getting the position of element layout boxes, obtaining the width
of the viewport through script, and also scrolling an element.</p>
<h2 class="no-num no-toc" id="sotd">Status of This Document</h2>
<p><em>This section describes the status of this document at the time of
its publication. Other documents may supersede this document. A list of
current W3C publications and the latest revision of this technical report
can be found in the <a href="http://www.w3.org/TR/">W3C technical reports
index at http://www.w3.org/TR/.</a></em>
<p>This is the 2 December 2014 Editor's Draft of CSSOM View. Please send
comments to
<a href="mailto:www-style@w3.org?subject=%5Bcssom-view%5D%20">www-style@w3.org</a>
(<a href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
with <samp>[cssom-view]</samp> at the start of the subject line.
<p>This document was produced by the <a href="http://www.w3.org/Style/CSS/members">CSS Working Group</a> (part of
the <a href="http://www.w3.org/Style/">Style Activity</a>).
<p>This document was produced by a group operating under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February
2004 W3C Patent Policy</a>. W3C maintains a <a href="http://www.w3.org/2004/01/pp-impl/32061/status" rel="disclosure">public list of any patent disclosures</a> made in
connection with the deliverables of the group; that page also includes
instructions for disclosing a patent. An individual who has actual
knowledge of a patent which the individual believes contains <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential
Claim(s)</a> must disclose the information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
6 of the W3C Patent Policy</a>.</p>
<p>Publication as a Working Draft does not imply endorsement by the W3C
Membership. This is a draft document and may be updated, replaced or
obsoleted by other documents at any time. It is inappropriate to cite this
document as other than work in progress.
<h2 class="no-num no-toc" id="toc">Table of Contents</h2>
<!--begin-toc-->
<ul class="toc">
<li><a href="#background"><span class="secno">1 </span>Background</a></li>
<li><a href="#conformance"><span class="secno">2 </span>Conformance</a>
<ul class="toc">
<li><a href="#web-idl"><span class="secno">2.1 </span>Web IDL</a></ul></li>
<li><a href="#terminology"><span class="secno">3 </span>Terminology</a>
<ul class="toc">
<li><a href="#css-pixels"><span class="secno">3.1 </span>CSS pixels</a></li>
<li><a href="#zooming"><span class="secno">3.2 </span>Zooming</a></ul></li>
<li><a href="#common-infrastructure"><span class="secno">4 </span>Common Infrastructure</a>
<ul class="toc">
<li><a href="#scrolling"><span class="secno">4.1 </span>Scrolling</a></li>
<li><a href="#webidl-values"><span class="secno">4.2 </span>WebIDL values</a></ul></li>
<li><a href="#extensions-to-the-window-interface"><span class="secno">5 </span>Extensions to the <code title="">Window</code> Interface</a>
<ul class="toc">
<li><a href="#the-features-argument-to-the-open()-method"><span class="secno">5.1 </span>The <var>features</var> argument to the <code title="">open()</code> method</a></li>
<li><a href="#the-mediaquerylist-interface"><span class="secno">5.2 </span>The <code title="">MediaQueryList</code> Interface</a></li>
<li><a href="#the-screen-interface"><span class="secno">5.3 </span>The <code title="">Screen</code> Interface</a></ul></li>
<li><a href="#extensions-to-the-document-interface"><span class="secno">6 </span>Extensions to the <code title="">Document</code> Interface</a>
<ul class="toc">
<li><a href="#the-caretposition-interface"><span class="secno">6.1 </span>The <code title="">CaretPosition</code> Interface</a></ul></li>
<li><a href="#extensions-to-the-element-interface"><span class="secno">7 </span>Extensions to the <code title="">Element</code> Interface</a>
<ul class="toc">
<li><a href="#the-getclientrects()-and-getboundingclientrect()-methods"><span class="secno">7.1 </span>The <code title="">getClientRects()</code> and
<code title="">getBoundingClientRect()</code> methods</a></li>
<li><a href="#element-scrolling-members"><span class="secno">7.2 </span><code title="">Element</code> Scrolling Members</a></ul></li>
<li><a href="#extensions-to-the-htmlelement-interface"><span class="secno">8 </span>Extensions to the <code title="">HTMLElement</code> Interface</a></li>
<li><a href="#excensions-to-the-htmlimageelement-interface"><span class="secno">9 </span>Excensions to the <code title="">HTMLImageElement</code> Interface</a></li>
<li><a href="#extensions-to-the-range-interface"><span class="secno">10 </span>Extensions to the <code title="">Range</code> Interface</a></li>
<li><a href="#extensions-to-the-mouseevent-interface"><span class="secno">11 </span>Extensions to the <code title="">MouseEvent</code> Interface</a></li>
<li><a href="#geometry"><span class="secno">12 </span>Geometry</a>
<ul class="toc">
<li><a class="atrisk" href="#the-geometryutils-interface"><span class="secno">12.1 </span>The <code title="">GeometryUtils</code> Interface</a></ul></li>
<li><a href="#events"><span class="secno">13 </span>Events</a>
<ul class="toc">
<li><a href="#resizing-viewports"><span class="secno">13.1 </span>Resizing viewports</a></li>
<li><a href="#scrolling-0"><span class="secno">13.2 </span>Scrolling</a></ul></li>
<li><a href="#css-properties"><span class="secno">14 </span>CSS properties</a>
<ul class="toc">
<li><a href="#smooth-scrolling:-the-'scroll-behavior'-property"><span class="secno">14.1 </span>Smooth Scrolling: The 'scroll-behavior' Property</a></ul></li>
<li><a class="no-num" href="#references">References</a></li>
<li><a class="no-num" href="#change-history">Change History</a>
<ul class="toc">
<li><a class="no-num" href="#changes-from-4-august-2011-to-17-december-2013">Changes From 4 August 2011 To 17 December 2013</a></ul></li>
<li><a class="no-num" href="#acknowledgments">Acknowledgments</a></ul>
<!--end-toc-->
<h2 id="background"><span class="secno">1 </span>Background</h2>
<p>Many of the features defined in this specification have been supported
by browsers for a long period of time. The goal of this specification is
to define these features in such a way that they can be implemented by all
browsers in an interoperable manner. The specification also defines a
couple of new features that will hopefully be useful to authors. (If they
are not you can bug us!)</p>
<h2 id="conformance"><span class="secno">2 </span>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 document are to be
interpreted as described in RFC2119. For readability, these words do
not appear in all uppercase letters in this specification. <a href="#refsRFC2119">[RFC2119]</a>
<p>Requirements phrased in the imperative as part of algorithms
(such as "strip any leading space characters" or "return false and
terminate these steps") are to be interpreted with the meaning of the
key word ("must", "should", "may", etc) used in introducing the
algorithm.
<p>Conformance requirements phrased as algorithms or specific steps
may be implemented in any manner, so long as the end result is
equivalent. (In particular, the algorithms defined in this
specification are intended to be easy to follow, and not intended to
be performant.)
<p id="hardwareLimitations">User agents may impose
implementation-specific limits on otherwise unconstrained inputs,
e.g. to prevent denial of service attacks, to guard against running
out of memory, or to work around platform-specific limitations. <!--fingerprint-->
<p>When a method or an attribute is said to call another method or attribute, the user agent must invoke its internal API for that attribute or method so that
e.g. the author can't change the behavior by overriding attributes or methods with custom properties or functions in ECMAScript.
<p>Unless otherwise stated, string comparisons are done in a <a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#case-sensitive">case-sensitive</a> manner.
<p>A conforming user agent implements all the requirements made by this
specification.</p>
<h3 id="web-idl"><span class="secno">2.1 </span>Web IDL</h3>
<p>The IDL fragments in this specification must be
interpreted as required for conforming IDL fragments, as described in the
Web IDL specification. <a href="#refsWEBIDL">[WEBIDL]</a>
<h2 id="terminology"><span class="secno">3 </span>Terminology</h2>
<p>Terminology used in this specification is from
DOM,
CSSOM and
HTML.
<a href="#refsDOM">[DOM]</a>
<a href="#refsCSSOM">[CSSOM]</a>
<a href="#refsHTML">[HTML]</a>
<p class="issue"><dfn id="mouseevent"><code>MouseEvent</code></dfn> and <dfn id="mouseeventinit"><code>MouseEventInit</code></dfn> are defined in …
<p><dfn id="dompoint"><code>DOMPoint</code></dfn>,
<dfn id="dompointreadonly"><code>DOMPointReadOnly</code></dfn>,
<dfn id="dompointinit"><code>DOMPointInit</code></dfn>,
<dfn id="domrect"><code>DOMRect</code></dfn>,
<dfn id="domrectreadonly"><code>DOMRectReadOnly</code></dfn>,
<dfn id="domrectlist"><code>DOMRectList</code></dfn> and
<dfn id="domquad"><code>DOMQuad</code></dfn> are defined in Geometry Interfaces Module. <a href="#refsGEOMETRY">[GEOMETRY]</a>
<p><dfn id="the-html-body-element">The HTML <code title="">body</code> element</dfn> is the first
<code title="">body</code>
<a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/infrastructure.html#html-elements" title="HTML elements">HTML element</a> child of the root
<a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/infrastructure.html#html-elements" title="HTML elements">HTML element</a> <code title="">html</code>.</p>
<p><dfn id="content-edge">Content edge</dfn>,
<dfn id="padding-edge">padding edge</dfn>,
<dfn id="border-edge">border edge</dfn>,
<dfn id="margin-edge">margin edge</dfn> and
<dfn id="canvas">canvas</dfn> are defined by CSS.
<!--<span data-anolis-ref>CSS</span>-->
<p><dfn id="viewport">Viewport</dfn> and <dfn id="initial-containing-block">initial containing block</dfn> are defined by CSS 2.1. <!--<span data-anolis-ref>CSS</span>-->
<p><dfn id="block-flow-direction">Block flow direction</dfn> and <dfn id="inline-base-direction">inline base direction</dfn> are defined in CSS Writing Modes Module. <a href="#refsCSSWRITINGMODES">[CSSWRITINGMODES]</a>
<p><dfn id="converted-to-an-idl-value">Converted to an IDL value</dfn> is defined in Web IDL. <a href="#refsWEBIDL">[WEBIDL]</a>
<p>Elements and <a href="#viewport" title="viewport">viewports</a> have an associated <dfn id="scrolling-box">scrolling box</dfn> if has a scrolling mechanism<!--XXX xref--> or it overflows
its content area<!--XXX xref--> and the used value of the 'overflow-x' or 'overflow-y' property is 'hidden'. <a href="#refsCSSBOX">[CSSBOX]</a>
<p>A <a href="#scrolling-box">scrolling box</a> of a <a href="#viewport">viewport</a> or element has two <dfn id="overflow-directions">overflow directions</dfn>, depending on the <a href="#viewport">viewport</a>'s or
element's <a href="#block-flow-direction">block flow direction</a> and <a href="#inline-base-direction">inline base direction</a>, as follows:
<dl class="switch">
<dt>If the <a href="#block-flow-direction">block flow direction</a> is top-to-bottom and the <a href="#inline-base-direction">inline base direction</a> is left-to-right
<dt>If the <a href="#block-flow-direction">block flow direction</a> is left-to-right and the <a href="#inline-base-direction">inline base direction</a> is left-to-right
<dd><p>Rightward and downward.
<dt>If the <a href="#block-flow-direction">block flow direction</a> is top-to-bottom and the <a href="#inline-base-direction">inline base direction</a> is right-to-left
<dt>If the <a href="#block-flow-direction">block flow direction</a> is right-to-left and the <a href="#inline-base-direction">inline base direction</a> is left-to-right
<dd><p>Leftward and downward.
<dt>If the <a href="#block-flow-direction">block flow direction</a> is right-to-left and the <a href="#inline-base-direction">inline base direction</a> is right-to-left
<dd><p>Leftward and upward.
<dt>If the <a href="#block-flow-direction">block flow direction</a> is left-to-right and the <a href="#inline-base-direction">inline base direction</a> is right-to-left
<dd><p>Righward and upward.
</dl>
<p>The term <dfn id="scrolling-area">scrolling area</dfn> refers to a box of a <a href="#viewport">viewport</a> or an element that has the following edges, depending on the
<a href="#viewport">viewport</a>'s or element's <a href="#scrolling-box">scrolling box</a>'s <a href="#overflow-directions">overflow directions</a>.
<table class="complex data">
<thead>
<tr>
<th>If the <a href="#overflow-directions">overflow directions</a> are…
<th>For a <a href="#viewport">viewport</a>
<th>For an element
<tbody>
<tr>
<td>rightward and downward
<td class="long">
<dl>
<dt>top edge
<dd><p>The top edge of the <a href="#initial-containing-block">initial containing block</a>.
<dt>right edge
<dd><p>The right-most edge of the right edge of the <a href="#initial-containing-block">initial containing block</a> and the right <a href="#margin-edge">margin edge</a> of the
<a href="#viewport">viewport</a>'s all descendant boxes.
<dt>bottom edge
<dd><p>The bottom-most edge of the bottom edge of the <a href="#initial-containing-block">initial containing block</a> and the bottom <a href="#margin-edge">margin edge</a> of the
<a href="#viewport">viewport</a>'s all descendant boxes.
<dt>left edge
<dd><p>The left edge of the <a href="#initial-containing-block">initial containing block</a>.
</dl>
<td class="long">
<dl>
<dt>top edge
<dd><p>The element's top <a href="#padding-edge">padding edge</a>.
<dt>right edge
<dd><p>The right-most edge of the element's right <a href="#padding-edge">padding edge</a> and the right <a href="#margin-edge">margin edge</a> of the element's all descendant boxes,
excluding boxes that have an ancestor of the element as their containing block.
<dt>bottom edge
<dd><p>The bottom-most edge of the element's bottom <a href="#padding-edge">padding edge</a> and the bottom <a href="#margin-edge">margin edge</a> of the element's all descendant
boxes, excluding boxes that have an ancestor of the element as their containing block.
<dt>left edge
<dd><p>The element's left <a href="#padding-edge">padding edge</a>.
</dl>
<tr>
<td>leftward and downward
<td class="long">
<dl>
<dt>top edge
<dd><p>The top edge of the <a href="#initial-containing-block">initial containing block</a>.
<dt>right edge
<dd><p>The right edge of the <a href="#initial-containing-block">initial containing block</a>.
<dt>bottom edge
<dd><p>The bottom-most edge of the bottom edge of the <a href="#initial-containing-block">initial containing block</a> and the bottom <a href="#margin-edge">margin edge</a> of the
<a href="#viewport">viewport</a>'s all descendant boxes.
<dt>left edge
<dd><p>The left-most edge of the left edge of the <a href="#initial-containing-block">initial containing block</a> and the left <a href="#margin-edge">margin edge</a> of the
<a href="#viewport">viewport</a>'s all descendant boxes.
</dl>
<td class="long">
<dl>
<dt>top edge
<dd><p>The element's top <a href="#padding-edge">padding edge</a>.
<dt>right edge
<dd><p>The element's right <a href="#padding-edge">padding edge</a>.
<dt>bottom edge
<dd><p>The bottom-most edge of the element's bottom <a href="#padding-edge">padding edge</a> and the bottom <a href="#margin-edge">margin edge</a> of the element's all descendant
boxes, excluding boxes that have an ancestor of the element as their containing block.
<dt>left edge
<dd><p>The left-most edge of the element's left <a href="#padding-edge">padding edge</a> and the left <a href="#margin-edge">margin edge</a> of the element's all descendant boxes,
excluding boxes that have an ancestor of the element as their containing block.
</dl>
<tr>
<td>leftward and upward
<td class="long">
<dl>
<dt>top edge
<dd><p>The top-most edge of the top edge of the <a href="#initial-containing-block">initial containing block</a> and the top <a href="#margin-edge">margin edge</a> of the
<a href="#viewport">viewport</a>'s all descendant boxes.
<dt>right edge
<dd><p>The right edge of the <a href="#initial-containing-block">initial containing block</a>.
<dt>bottom edge
<dd><p>The bottom edge of the <a href="#initial-containing-block">initial containing block</a>.
<dt>left edge
<dd><p>The left-most edge of the left edge of the <a href="#initial-containing-block">initial containing block</a> and the left <a href="#margin-edge">margin edge</a> of the
<a href="#viewport">viewport</a>'s all descendant boxes.
</dl>
<td class="long">
<dl>
<dt>top edge
<dd><p>The top-most edge of the element's top <a href="#padding-edge">padding edge</a> and the top <a href="#margin-edge">margin edge</a> of the element's all descendant boxes,
excluding boxes that have an ancestor of the element as their containing block.
<dt>right edge
<dd><p>The element's right <a href="#padding-edge">padding edge</a>.
<dt>bottom edge
<dd><p>The element's bottom <a href="#padding-edge">padding edge</a>.
<dt>left edge
<dd><p>The left-most edge of the element's left <a href="#padding-edge">padding edge</a> and the left <a href="#margin-edge">margin edge</a> of the element's all descendant boxes,
excluding boxes that have an ancestor of the element as their containing block.
</dl>
<tr>
<td>rightward and upward
<td class="long">
<dl>
<dt>top edge
<dd><p>The top-most edge of the top edge of the <a href="#initial-containing-block">initial containing block</a> and the top <a href="#margin-edge">margin edge</a> of the
<a href="#viewport">viewport</a>'s all descendant boxes.
<dt>right edge
<dd><p>The right-most edge of the right edge of the <a href="#initial-containing-block">initial containing block</a> and the right <a href="#margin-edge">margin edge</a> of the
<a href="#viewport">viewport</a>'s all descendant boxes.
<dt>bottom edge
<dd><p>The bottom edge of the <a href="#initial-containing-block">initial containing block</a>.
<dt>left edge
<dd><p>The left edge of the <a href="#initial-containing-block">initial containing block</a>.
</dl>
<td class="long">
<dl>
<dt>top edge
<dd><p>The top-most edge of the element's top <a href="#padding-edge">padding edge</a> and the top <a href="#margin-edge">margin edge</a> of the element's all descendant boxes,
excluding boxes that have an ancestor of the element as their containing block.
<dt>right edge
<dd><p>The right-most edge of the element's right <a href="#padding-edge">padding edge</a> and the right <a href="#margin-edge">margin edge</a> of the element's all descendant boxes,
excluding boxes that have an ancestor of the element as their containing block.
<dt>bottom edge
<dd><p>The element's bottom <a href="#padding-edge">padding edge</a>.
<dt>left edge
<dd><p>The element's left <a href="#padding-edge">padding edge</a>.
</dl>
</table>
<p>The <dfn id="scrolling-area-origin" title="scrolling area origin">origin</dfn> of a <a href="#scrolling-area">scrolling area</a> is
the origin of the <a href="#initial-containing-block">initial containing block</a> if the <a href="#scrolling-area">scrolling area</a> is a <a href="#viewport">viewport</a>,
and otherwise the top left padding edge of the element when the element has its default scroll position.
The x-coordinate increases rightwards, and the y-coordinate increases downwards.
<p>The <dfn id="beginning-edges">beginning edges</dfn> of a particular set of edges of a box or element are the following edges:
<dl class="switch">
<dt>If the <a href="#overflow-directions">overflow directions</a> are rightward and downward
<dd><p>The top and left edges.
<dt>If the <a href="#overflow-directions">overflow directions</a> are leftward and downward
<dd><p>The top and right edges.
<dt>If the <a href="#overflow-directions">overflow directions</a> are leftward and upward
<dd><p>The bottom and right edges.
<dt>If the <a href="#overflow-directions">overflow directions</a> are rightward and upward
<dd><p>The bottom and left edges.
</dl>
<p>The <dfn id="ending-edges">ending edges</dfn> of a particular set of edges of a box or element are the following edges:
<dl class="switch">
<dt>If the <a href="#overflow-directions">overflow directions</a> are rightward and downward
<dd><p>The bottom and right edges.
<dt>If the <a href="#overflow-directions">overflow directions</a> are leftward and downward
<dd><p>The bottom and left edges.
<dt>If the <a href="#overflow-directions">overflow directions</a> are leftward and upward
<dd><p>The top and left edges.
<dt>If the <a href="#overflow-directions">overflow directions</a> are rightward and upward
<dd><p>The top and right edges.
</dl>
<p>The term <dfn id="css-layout-box">CSS layout box</dfn> refers to the same term in CSS. For the purpose
of the requirements in this specification, elements that have a computed value of the
'display' property that is 'table-column' or
'table-column-group' must be considered to have an associated <a href="#css-layout-box">CSS
layout box</a> (the column or column group, respectively).</p>
<p>The term <dfn id="svg-layout-box">SVG layout box</dfn> refers to the same term in SVG.
<p class="issue">The terms <a href="#css-layout-box">CSS layout box</a> and <a href="#svg-layout-box">SVG layout box</a> are not currently defined by CSS or SVG.
<p>The term <dfn id="layout-box">layout box</dfn> refers to either a <a href="#css-layout-box">CSS layout box</a> or an <a href="#svg-layout-box">SVG layout box</a>.
<p>The term <dfn id="transforms">transforms</dfn> refers to SVG transforms and CSS transforms. <a href="#refsSVG">[SVG]</a> <a href="#refsCSSTRANSFORMS">[CSSTRANSFORMS]</a>
<h3 id="css-pixels"><span class="secno">3.1 </span>CSS pixels</h3>
<p>All coordinates and dimensions for the APIs defined in this
specification are in CSS pixels, unless otherwise specified. <!--<span data-anolis-ref>CSS</span>-->
<p class="note">This does not apply to e.g.
<code title="dom-Window-matchMedia"><a href="#dom-window-matchmedia">matchMedia()</a></code> as the units
are explicitly given there.</p>
<h3 id="zooming"><span class="secno">3.2 </span>Zooming</h3>
<p>There are two kinds of zoom, <dfn id="page-zoom">page zoom</dfn> which affects the size of the initial viewport<!-- XXX ref -->, and <dfn id="pinch-zoom">pinch zoom</dfn> which acts like
a magnifying glass and does not affect the initial viewport<!-- XXX ref --> or actual viewport<!-- XXX ref -->. <a href="#refsCSSDEVICEADAPT">[CSSDEVICEADAPT]</a>
<h2 id="common-infrastructure"><span class="secno">4 </span>Common Infrastructure</h2>
<h3 id="scrolling"><span class="secno">4.1 </span>Scrolling</h3>
<p>When a user agent is to <dfn id="perform-a-scroll">perform a scroll</dfn> of a <a href="#scrolling-box">scrolling box</a> <var>box</var>,
to a given position <var>position</var>,
an associated element <var>element</var> and optionally a scroll behavior <var>behavior</var>
(which is <code title="">auto</code> if omitted),
the following steps must be run:
<ol>
<li><p><a href="#concept-smooth-scroll-aborted" title="concept-smooth-scroll-aborted">Abort</a> any ongoing <a href="#concept-smooth-scroll" title="concept-smooth-scroll">smooth scroll</a> for <var>box</var>.
<li><p>If the user agent honors the '<a href="#scroll-behavior">scroll-behavior</a>' property and one of the following are true:
<ul>
<li><p><var>behavior</var> is <code title="">auto</code> and <var>element</var> is not null and its computed value of the
'<a href="#scroll-behavior">scroll-behavior</a>' property is '<a href="#scroll-behavior-smooth" title="scroll-behavior-smooth">smooth</a>'
<li><p><var>behavior</var> is <code title="">smooth</code>
</ul>
<p>...then perform a <a href="#concept-smooth-scroll" title="concept-smooth-scroll">smooth scroll</a> of <var>box</var> to <var>position</var>.
Otherwise, perform an <a href="#concept-instant-scroll" title="concept-instant-scroll">instant scroll</a> of <var>box</var> to <var>position</var>.
</ol>
<p>When a user agent is to perform a <dfn id="concept-smooth-scroll" title="concept-smooth-scroll">smooth scroll</dfn> of a <a href="#scrolling-box">scrolling box</a> <var>box</var> to <var>position</var>,
it must update the scroll position of <var>box</var> in a user-agent-defined fashion over a user-agent-defined amount of time. When the scroll is
<dfn id="concept-smooth-scroll-completed" title="concept-smooth-scroll-completed">completed</dfn>, the scroll position of <var>box</var> must be <var>position</var>. The scroll can also
be <dfn id="concept-smooth-scroll-aborted" title="concept-smooth-scroll-aborted">aborted</dfn>, either by an algorithm or by the user. <!--fingerprint-->
<p>When a user agent is to perform an <dfn id="concept-instant-scroll" title="concept-instant-scroll">instant scroll</dfn> of a <a href="#scrolling-box">scrolling box</a> <var>box</var> to
<var>position</var>, it must update the scroll position of <var>box</var> to <var>position</var>.
<p>To <dfn id="scroll-to-the-beginning-of-the-document">scroll to the beginning of the document</dfn> for a document <var>document</var>, follow these steps:
<ol>
<li><p>Let <var>viewport</var> be the <a href="#viewport">viewport</a> that is associated with <var>document</var>. <!-- This assumes that there is a viewport, since
it is only invoked when navigating -->
<li><p>Let <var>position</var> be the the scroll position <var>viewport</var> would have by aligning the <a href="#beginning-edges">beginning edges</a> of the
<a href="#scrolling-area">scrolling area</a> with the <a href="#beginning-edges">beginning edges</a> of <var>viewport</var>.
<li><p>If <var>position</var> is the same as <var>viewport</var>'s current scroll position, and <var>viewport</var> does not have an ongoing
<a href="#concept-smooth-scroll" title="concept-smooth-scroll">smooth scroll</a>, abort these steps.
<li><p><a href="#perform-a-scroll">Perform a scroll</a> of <var>viewport</var> to <var>position</var>,
and <var>document</var>'s root element as the associated element, if there is one, or null otherwise.
</ol>
<p class="note">This algorithm is used when navigating to the <code title="">#top</code> fragment identifier, as defined in HTML. <a href="#refsHTML">[HTML]</a>
<h3 id="webidl-values"><span class="secno">4.2 </span>WebIDL values</h3>
<p>When asked to <dfn id="normalize-non-finite-values">normalize non-finite values</dfn> for a value <var>x</var>,
if <var>x</var> is one of the three special floating point literal values
(<code title="">Infinity</code>, <code title="">-Infinity</code> or <code title="">NaN</code>),
then <var>x</var> must be changed to the value <code title="">0</code>. <a href="#refsWEBIDL">[WEBIDL]</a>
<h2 id="extensions-to-the-window-interface"><span class="secno">5 </span>Extensions to the <code title="">Window</code> Interface</h2>
<pre class="idl">enum <dfn id="scrollbehavior">ScrollBehavior</dfn> { "auto", "instant", "smooth" };
dictionary <dfn id="scrolloptions">ScrollOptions</dfn> {
<a href="#scrollbehavior">ScrollBehavior</a> behavior = "auto";
};
dictionary <dfn id="scrolltooptions">ScrollToOptions</dfn> : <a href="#scrolloptions">ScrollOptions</a> {
double left;
double top;<!--
double right;
double bottom;
double blockStart;
double blockEnd;
double inlineStart;
double inlineEnd;-->
};
partial interface <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/browsers.html#window">Window</a> {
[NewObject] <a href="#mediaquerylist">MediaQueryList</a> <a href="#dom-window-matchmedia" title="dom-Window-matchMedia">matchMedia</a>(DOMString query);
[SameObject] readonly attribute <a href="#screen">Screen</a> <a href="#dom-window-screen" title="dom-Window-screen">screen</a>;
// browsing context
void <a href="#dom-window-moveto" title="dom-Window-moveTo">moveTo</a>(unrestricted double x, unrestricted double y);
void <a href="#dom-window-moveby" title="dom-Window-moveBy">moveBy</a>(unrestricted double x, unrestricted double y);
void <a href="#dom-window-resizeto" title="dom-Window-resizeTo">resizeTo</a>(unrestricted double x, unrestricted double y);
void <a href="#dom-window-resizeby" title="dom-Window-resizeBy">resizeBy</a>(unrestricted double x, unrestricted double y);
// viewport
readonly attribute double <a href="#dom-window-innerwidth" title="dom-Window-innerWidth">innerWidth</a>;
readonly attribute double <a href="#dom-window-innerheight" title="dom-Window-innerHeight">innerHeight</a>;
// viewport scrolling
readonly attribute double <a href="#dom-window-scrollx" title="dom-Window-scrollX">scrollX</a>;
readonly attribute double <a href="#dom-window-pagexoffset" title="dom-Window-pageXOffset">pageXOffset</a>;
readonly attribute double <a href="#dom-window-scrolly" title="dom-Window-scrollY">scrollY</a>;
readonly attribute double <a href="#dom-window-pageyoffset" title="dom-Window-pageYOffset">pageYOffset</a>;
void <a href="#dom-window-scroll" title="dom-Window-scroll">scroll</a>(optional <a href="#scrolltooptions">ScrollToOptions</a> options);
void <a href="#dom-window-scroll" title="dom-Window-scroll">scroll</a>(unrestricted double x, unrestricted double y);
void <a href="#dom-window-scrollto" title="dom-Window-scrollTo">scrollTo</a>(optional <a href="#scrolltooptions">ScrollToOptions</a> options);
void <a href="#dom-window-scrollto" title="dom-Window-scrollTo">scrollTo</a>(unrestricted double x, unrestricted double y);
void <a href="#dom-window-scrollby" title="dom-Window-scrollBy">scrollBy</a>(optional <a href="#scrolltooptions">ScrollToOptions</a> options);
void <a href="#dom-window-scrollby" title="dom-Window-scrollBy">scrollBy</a>(unrestricted double x, unrestricted double y);
// client
readonly attribute double <a href="#dom-window-screenx" title="dom-Window-screenX">screenX</a>;
readonly attribute double <a href="#dom-window-screeny" title="dom-Window-screenY">screenY</a>;
readonly attribute double <a href="#dom-window-outerwidth" title="dom-Window-outerWidth">outerWidth</a>;
readonly attribute double <a href="#dom-window-outerheight" title="dom-Window-outerHeight">outerHeight</a>;
readonly attribute double <a href="#dom-window-devicepixelratio" title="dom-Window-devicePixelRatio">devicePixelRatio</a>;
};</pre>
<p>When the <dfn id="dom-window-matchmedia" title="dom-Window-matchMedia"><code>matchMedia(<var>query</var>)</code></dfn> method is invoked these steps must be run:</p>
<ol>
<li><p>Let <var>parsed media query list</var> be the result of
<a class="external" data-anolis-spec="cssom" href="http://dev.w3.org/csswg/cssom/#parse-a-media-query-list" title="parse a media query list">parsing</a>
<var>query</var>.</li>
<li><p>Return a new <code><a href="#mediaquerylist">MediaQueryList</a></code> object,
with the <a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#context-object">context object</a>'s
<a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/browsers.html#concept-document-window" title="concept-document-window">associated <code title="">Document</code></a>
as the <a href="#concept-mediaquerylist-document" title="concept-MediaQueryList-document">document</a>,
with <var>parsed media query list</var> as its associated <a href="#media-query-list">media query list</a>.</li>
</ol>
<p>The <dfn id="dom-window-screen" title="dom-Window-screen"><code>screen</code></dfn> attribute must return the <code><a href="#screen">Screen</a></code> object
associated with the <code class="external" data-anolis-spec="html"><a href="https://html.spec.whatwg.org/multipage/browsers.html#window">Window</a></code> object.</p>
<p class="note">Accessing <code title="dom-Window-screen"><a href="#dom-window-screen">screen</a></code> through a <code class="external" data-anolis-spec="html"><a href="https://html.spec.whatwg.org/multipage/browsers.html#windowproxy">WindowProxy</a></code> object might yield different
results when the <code class="external" data-anolis-spec="dom"><a href="https://dom.spec.whatwg.org/#document">Document</a></code> is navigated.</p>
<p>The <dfn id="dom-window-moveto" title="dom-Window-moveTo">moveTo(<var>x</var>, <var>y</var>)</dfn> method must follow these steps:
<ol>
<li><p>Optionally, terminate these steps.
<li><p><a href="#normalize-non-finite-values">Normalize non-finite values</a> for <var>x</var> and <var>y</var>.
<li><p>Let <var>target</var> be the <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/browsers.html#browsing-context">browsing context</a> of the <a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#context-object">context
object</a>.
<li><p>Let <var>source</var> be the <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#responsible-browsing-context">responsible browsing context</a> of the <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#incumbent-settings-object">incumbent settings
object</a>.
<li><p>If <var>source</var> is not <a href="#allowed-to-resize-and-move">allowed to resize and move</a> <var>target</var>, terminate these steps.
<li><p>Optionally, clamp <var>x</var> and <var>y</var> in a user-agent-defined manner so that the window does not move outside the available space.
<li><p>Move <var>target</var>'s window such that the window's top left corner is at coordinates (<var>x</var>, <var>y</var>) relative to the top left corner of
the output device, measured in CSS pixels of <var>target</var>. The positive axes are rightward and downward.
</ol>
<p>The <dfn id="dom-window-moveby" title="dom-Window-moveBy">moveBy(<var>x</var>, <var>y</var>)</dfn> method must follow these steps:
<ol>
<li><p>Optionally, terminate these steps.
<li><p><a href="#normalize-non-finite-values">Normalize non-finite values</a> for <var>x</var> and <var>y</var>.
<li><p>Let <var>target</var> be the <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/browsers.html#browsing-context">browsing context</a> of the <a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#context-object">context
object</a>.
<li><p>Let <var>source</var> be the <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#responsible-browsing-context">responsible browsing context</a> of the <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#incumbent-settings-object">incumbent settings
object</a>.
<li><p>If <var>source</var> is not <a href="#allowed-to-resize-and-move">allowed to resize and move</a> <var>target</var>, terminate these steps.
<li><p>Optionally, clamp <var>x</var> and <var>y</var> in a user-agent-defined manner so that the window does not move outside the available space.
<li><p>Move <var>target</var>'s window <var>x</var> CSS pixels of <var>target</var> righward and <var>y</var> CSS pixels of <var>target</var> downward.
</ol>
<p>The <dfn id="dom-window-resizeto" title="dom-Window-resizeTo">resizeTo(<var>x</var>, <var>y</var>)</dfn> method must follow these steps:
<ol>
<li><p>Optionally, terminate these steps.
<li><p><a href="#normalize-non-finite-values">Normalize non-finite values</a> for <var>x</var> and <var>y</var>.
<li><p>Let <var>target</var> be the <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/browsers.html#browsing-context">browsing context</a> of the <a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#context-object">context
object</a>.
<li><p>Let <var>source</var> be the <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#responsible-browsing-context">responsible browsing context</a> of the <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#incumbent-settings-object">incumbent settings
object</a>.
<li><p>If <var>source</var> is not <a href="#allowed-to-resize-and-move">allowed to resize and move</a> <var>target</var>, terminate these steps.
<li><p>Optionally, clamp <var>x</var> and <var>y</var> in a user-agent-defined manner so that the window does not get too small or bigger than the available
space.
<li><p>Resize <var>target</var>'s window by moving its right and bottom edges such that the distance between the left and right edges of the viewport are
<var>x</var> CSS pixels of <var>target</var> and the distance between the top and bottom edges of the viewport are <var>y</var> CSS pixels of
<var>target</var>.
<li><p>Optionally, move <var>target</var>'s window in a user-agent-defined manner so that it does not grow outside the available space.
</ol>
<p>The <dfn id="dom-window-resizeby" title="dom-Window-resizeBy">resizeBy(<var>x</var>, <var>y</var>)</dfn> method must follow these steps:
<ol>
<li><p>Optionally, terminate these steps.
<li><p>Let <var>target</var> be the <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/browsers.html#browsing-context">browsing context</a> of the <a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#context-object">context
object</a>.
<li><p>Let <var>source</var> be the <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#responsible-browsing-context">responsible browsing context</a> of the <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#incumbent-settings-object">incumbent settings
object</a>.
<li><p>If <var>source</var> is not <a href="#allowed-to-resize-and-move">allowed to resize and move</a> <var>target</var>, terminate these steps.
<li><p>Optionally, clamp <var>x</var> and <var>y</var> in a user-agent-defined manner so that the window does not get too small or bigger than the available
space.
<li><p>Resize <var>target</var>'s window by moving its right edge <var>x</var> CSS pixels of <var>target</var> righward and its bottom edge <var>y</var> CSS
pixels of <var>target</var> downward.
<li><p>Optionally, move <var>target</var>'s window in a user-agent-defined manner so that it does not grow outside the available space.
</ol>
<p>A <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/browsers.html#browsing-context">browsing context</a> <var>A</var> is <dfn id="allowed-to-resize-and-move">allowed to resize and move</dfn> a <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/browsers.html#browsing-context">browsing
context</a> <var>B</var> if all the following conditions are met:
<ul>
<li><p><var>B</var> is an <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/browsers.html#auxiliary-browsing-context">auxiliary browsing context</a> that was created by a script (as opposed to by an action of the user).
<li><p><var>A</var> is <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/browsers.html#familiar-with">familiar with</a> <var>B</var>.
</ul>
<p>The <dfn id="dom-window-innerwidth" title="dom-Window-innerWidth"><code>innerWidth</code></dfn> attribute must return the <a href="#viewport">viewport</a> width including the size of a rendered
scroll bar (if any), or zero if there is no <a href="#viewport">viewport</a>. <!--fingerprint--></p>
<div class="example">
<p>The following snippet shows how to obtain the width of the viewport:</p>
<pre>var viewportWidth = innerWidth</pre>
</div>
<p>The <dfn id="dom-window-innerheight" title="dom-Window-innerHeight"><code>innerHeight</code></dfn> attribute must return the <a href="#viewport">viewport</a> height including the size of a rendered
scroll bar (if any), or zero if there is no <a href="#viewport">viewport</a>. <!--fingerprint--></p>
<p>The <dfn id="dom-window-scrollx" title="dom-Window-scrollX"><code>scrollX</code></dfn> attribute attribute must return the x-coordinate, relative to the <a href="#initial-containing-block">initial containing
block</a> origin, of the left of the <a href="#viewport">viewport</a>, or zero if there is no <a href="#viewport">viewport</a>. <!--fingerprint--></p>
<p>The <dfn id="dom-window-pagexoffset" title="dom-Window-pageXOffset"><code>pageXOffset</code></dfn> attribute must return the value returned by the
<code title="dom-Window-scrollX"><a href="#dom-window-scrollx">scrollX</a></code> attribute.</p>
<p>The <dfn id="dom-window-scrolly" title="dom-Window-scrollY"><code>scrollY</code></dfn> attribute attribute must return the y-coordinate, relative to the <a href="#initial-containing-block">initial containing
block</a> origin, of the top of the <a href="#viewport">viewport</a>, or zero if there is no <a href="#viewport">viewport</a>. <!--fingerprint--></p>
<p>The <dfn id="dom-window-pageyoffset" title="dom-Window-pageYOffset"><code>pageYOffset</code></dfn> attribute must return the value returned by the
<code title="dom-Window-scrollY"><a href="#dom-window-scrolly">scrollY</a></code> attribute.</p>
<p>When the <dfn id="dom-window-scroll" title="dom-Window-scroll"><code>scroll()</code></dfn> method is invoked these
steps must be run:</p>
<ol>
<li><p>If invoked with one argument, follow these substeps:
<ol>
<li><p>Let <var>options</var> be the argument.
<li><p>Let <var>x</var> be the value of the <code title="">left</code> dictionary member of <var>options</var>, if present, or the <a href="#viewport">viewport</a>'s current scroll position on the x axis otherwise.
<li><p>Let <var>y</var> be the value of the <code title="">top</code> dictionary member of <var>options</var>, if present, or the <a href="#viewport">viewport</a>'s current scroll position on the y axis otherwise.
</ol>
<li><p>If invoked with two arguments, follow these substeps:
<ol>
<li><p>Let <var>options</var> be null <a href="#converted-to-an-idl-value" title="converted to an IDL value">converted</a> to a <code><a href="#scrolltooptions">ScrollToOptions</a></code> dictionary. <a href="#refsWEBIDL">[WEBIDL]</a>
<li><p>Let <var>x</var> and <var>y</var> be the arguments, respectively.
<li><p><a href="#normalize-non-finite-values">Normalize non-finite values</a> for <var>x</var> and <var>y</var>.
</ol>
<li><p>If there is no <a href="#viewport">viewport</a>, abort these steps.
<li><p>Let <var>viewport width</var> be the width of the <a href="#viewport">viewport</a> excluding the width of the scroll bar, if any.
<li><p>Let <var>viewport height</var> be the height of the <a href="#viewport">viewport</a> excluding the height of the scroll bar, if any.
<li>
<dl class="switch">
<dt>If the <a href="#viewport">viewport</a> has rightward <a href="#overflow-directions" title="overflow directions">overflow direction</a>
<dd><p>Let <var>x</var> be max(0, min(<var>x</var>,
<a href="#viewport">viewport</a> <a href="#scrolling-area">scrolling area</a> width - <var>viewport width</var>)).</dd>
<dt>If the <a href="#viewport">viewport</a> has leftward <a href="#overflow-directions" title="overflow directions">overflow direction</a>
<dd><p>Let <var>x</var> be min(0, max(<var>x</var>,
<var>viewport width</var> - <a href="#viewport">viewport</a> <a href="#scrolling-area">scrolling area</a>
width)).</dd>
</dl>
<li>
<dl class="switch">
<dt>If the <a href="#viewport">viewport</a> has downward <a href="#overflow-directions" title="overflow directions">overflow direction</a>
<dd><p>Let <var>y</var> be max(0, min(<var>y</var>,
<a href="#viewport">viewport</a> <a href="#scrolling-area">scrolling area</a> height - <var>viewport height</var>)).</dd>
<dt>If the <a href="#viewport">viewport</a> has upward <a href="#overflow-directions" title="overflow directions">overflow direction</a>
<dd><p>Let <var>y</var> be min(0, max(<var>y</var>,
<var>viewport height</var> - <a href="#viewport">viewport</a> <a href="#scrolling-area">scrolling area</a>
height)).</dd>
</dl>
<li><p>Let <var>position</var> be the scroll position the <a href="#viewport">viewport</a> would have by aligning the x-coordinate <var>x</var> of the
<a href="#viewport">viewport</a> <a href="#scrolling-area">scrolling area</a> with the left of the <a href="#viewport">viewport</a> and aligning the y-coordinate <var>y</var> of the
<a href="#viewport">viewport</a> <a href="#scrolling-area">scrolling area</a> with the top of the <a href="#viewport">viewport</a>.
<li><p>If <var>position</var> is the same as the <a href="#viewport">viewport</a>'s current scroll position, and the <a href="#viewport">viewport</a> does not have an ongoing
<a href="#concept-smooth-scroll" title="concept-smooth-scroll">smooth scroll</a>, abort these steps.
<li><p>Let <var>document</var> be the <a href="#viewport">viewport</a>'s associated <code class="external" data-anolis-spec="dom"><a href="https://dom.spec.whatwg.org/#document">Document</a></code>.
<li><p><a href="#perform-a-scroll">Perform a scroll</a> of the <a href="#viewport">viewport</a> to <var>position</var>,
<var>document</var>'s root element as the associated element, if there is one, or null otherwise,
and the scroll behavior being the value of the <code title="">behavior</code> dictionary member of <var>options</var>.
</ol>
<p>When the <dfn id="dom-window-scrollto" title="dom-Window-scrollTo"><code>scrollTo()</code></dfn> method is invoked, the
user agent must act as if the <code title="dom-Window-scroll"><a href="#dom-window-scroll">scroll()</a></code> method was invoked with the same arguments.</p>
<p>When the <dfn id="dom-window-scrollby" title="dom-Window-scrollBy"><code>scrollBy()</code></dfn> method is invoked, the
user agent must run these steps:
<ol>
<li><p>If invoked with two arguments, follow these substeps:
<ol>
<li><p>Let <var>options</var> be null <a href="#converted-to-an-idl-value" title="converted to an IDL value">converted</a> to a <code><a href="#scrolltooptions">ScrollToOptions</a></code> dictionary. <a href="#refsWEBIDL">[WEBIDL]</a>
<li><p>Let <var>x</var> and <var>y</var> be the arguments, respectively.
<li><p><a href="#normalize-non-finite-values">Normalize non-finite values</a> for <var>x</var> and <var>y</var>.
<li><p>Let the <code title="">left</code> dictionary member of <var>options</var> have the value <var>x</var>.
<li><p>Let the <code title="">top</code> dictionary member of <var>options</var> have the value <var>y</var>.
</ol>
<li><p>Add the value of <code title="dom-Window-scrollX"><a href="#dom-window-scrollx">scrollX</a></code> to the <code title="">left</code> dictionary member.
<li><p>Add the value of <code title="dom-Window-scrollY"><a href="#dom-window-scrolly">scrollY</a></code> to the <code title="">top</code> dictionary member.
<li><p>Act as if the <code title="dom-Window-scroll"><a href="#dom-window-scroll">scroll()</a></code> method was invoked with
<var>options</var> as the only argument.</p>
</ol>
<p>The <dfn id="dom-window-screenx" title="dom-Window-screenX"><code>screenX</code></dfn> attribute must return the x-coordinate,
relative to the origin of the screen of the output device, of the left of
the client window as number of pixels, or zero if there is no such
thing. <!--fingerprint--></p>
<p>The <dfn id="dom-window-screeny" title="dom-Window-screenY"><code>screenY</code></dfn> attribute must return the y-coordinate,
relative to the origin of the screen of the output device, of the top of
the client window as number of pixels, or zero if there is no such
thing. <!--fingerprint--></p>
<p>The <dfn id="dom-window-outerwidth" title="dom-Window-outerWidth"><code>outerWidth</code></dfn> attribute must return the width of the
client window. If there is no client window this
attribute must return zero. <!--fingerprint--></p>
<p>The <dfn id="dom-window-outerheight" title="dom-Window-outerHeight"><code>outerHeight</code></dfn> attribute must return the height of the
client window. If there is no client window this
attribute must return zero. <!--fingerprint--></p>
<p>The <dfn id="dom-window-devicepixelratio" title="dom-Window-devicePixelRatio"><code>devicePixelRatio</code></dfn> attribute must return the result of the following algorithm:
<ol>
<li><p>If there is no output device, return 1 and abort these steps.
<li><p>Let <var>CSS pixel size</var> be the size of a CSS pixel at the current <a href="#page-zoom">page zoom</a> scale factor and at a <a href="#pinch-zoom">pinch zoom</a> scale
factor of 1.0.
<li><p>Let <var>device pixel size</var> be the vertical size of a device pixel of the output device.
<li><p>Return the result of dividing <var>CSS pixel size</var> by <var>device pixel size</var>.
</ol>
<h4 id="the-features-argument-to-the-open()-method"><span class="secno">5.1 </span>The <var>features</var> argument to the <code title="">open()</code> method</h4>
<p>HTML defines the <code class="external" data-anolis-spec="html" title="dom-open"><a href="https://html.spec.whatwg.org/multipage/browsers.html#dom-open">open()</a></code> method but has no defined effect for the third argument, <var>features</var>.
<a href="#refsHTML">[HTML]</a>
<p>This specification defines the effect of the <var>features</var> argument for user agents that do not opt to ignore it, as follows:
<ol>
<li><p>If the method does not result in a new <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/browsers.html#auxiliary-browsing-context">auxiliary browsing context</a> being created, terminate these steps.
<li><p>Let <var>target</var> be the new <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/browsers.html#auxiliary-browsing-context">auxiliary browsing context</a>.
<li><p>Let <var>tokens</var> be the result of <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/infrastructure.html#split-a-string-on-commas" title="split a string on commas">splitting <var>features</var> on commas</a>.
<li><p>Let <var>parsed features</var> be a new empty dictionary.
<li><p><i>Token loop</i>: For each token <var>token</var> in <var>tokens</var>, follow these substeps:
<ol>
<li><p>Let <var>input</var> be <var>token</var>.
<li><p>Let <var>position</var> point at the first character of <var>input</var>.
<li><p><a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/infrastructure.html#skip-whitespace">Skip whitespace</a>.
<li><p><a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/infrastructure.html#collect-a-sequence-of-characters">Collect a sequence of characters</a> that are not <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/infrastructure.html#space-character" title="space character">space
characters</a> nor "<code title="">=</code>" (U+003D). Let <var>name</var> be the collected characters, <a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#converted-to-ascii-lowercase">converted to ASCII
lowercase</a>.
<li><p>If <var>name</var> is in <var>parsed features</var> or if <var>name</var> is not a <a href="#supported-open()-feature-name">supported <code title="">open()</code> feature name</a>,
continue <i>token loop</i>.
<li><p><a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/infrastructure.html#skip-whitespace">Skip whitespace</a>.
<li><p>If the character at <var>position</var> is not "<code title="">=</code>" (U+003D), continue <i>token loop</i>.
<li><p>Advance <var>position</var> by one.
<li><p>If <var>position</var> is past the end of <var>input</var>, continue <i>token loop</i>.
<li><p><a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/infrastructure.html#collect-a-sequence-of-characters">Collect a sequence of characters</a> that are any characters. Let <var>raw value</var> be the collected characters.
<li><p>Let <var>value</var> be the result of invoking the <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-integers">rules for parsing integers</a> on <var>raw value</var>.
<li><p>If <var>value</var> is an error, continue <i>token loop</i>.
<li><p>Set <var>name</var> in <var>parsed features</var> to <var>value</var>.
</ol>
<li><p>If <code title="dom-open-features-left"><a href="#dom-open-features-left">left</a></code> is present in <var>parsed features</var>, follow these substeps:
<ol>
<li><p>Let <var>x</var> be the value of <code title="dom-open-features-left"><a href="#dom-open-features-left">left</a></code>.
<li><p>Optionally, clamp <var>x</var> in a user-agent-defined manner so that the window does not move outside the available space.
<li><p>Optionally, move <var>target</var>'s window such that the window's left edge is at the horizontal coordinate <var>x</var> relative to the left edge of
the output device, measured in CSS pixels of <var>target</var>. The positive axis is rightward.
</ol>
<li><p>If <code title="dom-open-features-top"><a href="#dom-open-features-top">top</a></code> is present in <var>parsed features</var>, follow these substeps:
<ol>
<li><p>Let <var>y</var> be the value of <code title="dom-open-features-top"><a href="#dom-open-features-top">top</a></code>.
<li><p>Optionally, clamp <var>y</var> in a user-agent-defined manner so that the window does not move outside the available space.
<li><p>Optionally, move <var>target</var>'s window such that the window's top edge is at the vertical coordinate <var>y</var> relative to the top edge of
the output device, measured in CSS pixels of <var>target</var>. The positive axis is downward.
</ol>
<li><p>If <code title="dom-open-features-width"><a href="#dom-open-features-width">width</a></code> is present in <var>parsed features</var>, follow these substeps:
<ol>
<li><p>Let <var>x</var> be the value of <code title="dom-open-features-width"><a href="#dom-open-features-width">width</a></code>.
<li><p>Optionally, clamp <var>x</var> in a user-agent-defined manner so that the window does not get too small or bigger than the available space.
<li><p>Optionally, size <var>target</var>'s window by moving its right edge such that the distance between the left and right edges of the viewport are
<var>x</var> CSS pixels of <var>target</var>.
<li><p>Optionally, move <var>target</var>'s window in a user-agent-defined manner so that it does not grow outside the available space.
</ol>
<li><p>If <code title="dom-open-features-height"><a href="#dom-open-features-height">height</a></code> is present in <var>parsed features</var>, follow these substeps:
<ol>
<li><p>Let <var>y</var> be the value of <code title="dom-open-features-height"><a href="#dom-open-features-height">height</a></code>.
<li><p>Optionally, clamp <var>y</var> in a user-agent-defined manner so that the window does not get too small or bigger than the available space.
<li><p>Optionally, size <var>target</var>'s window by moving its bottom edge such that the distance between the top and bottom edges of the viewport are
<var>y</var> CSS pixels of <var>target</var>.
<li><p>Optionally, move <var>target</var>'s window in a user-agent-defined manner so that it does not grow outside the available space.
</ol>
</ol>
<p>A <dfn id="supported-open()-feature-name">supported <code title="">open()</code> feature name</dfn> is one of the following:
<dl>
<dt><dfn id="dom-open-features-width" title="dom-open-features-width">width</dfn>
<dd><p>The width of the viewport.
<dt><dfn id="dom-open-features-height" title="dom-open-features-height">height</dfn>
<dd><p>The height of the viewport.
<dt><dfn id="dom-open-features-left" title="dom-open-features-left">left</dfn>
<dd><p>The left position of the window.
<dt><dfn id="dom-open-features-top" title="dom-open-features-top">top</dfn>
<dd><p>The top position of the window.
</dl>
<h3 id="the-mediaquerylist-interface"><span class="secno">5.2 </span>The <code title="">MediaQueryList</code> Interface</h3>
<p>A <code><a href="#mediaquerylist">MediaQueryList</a></code> object has an associated <dfn id="media-query-list">media query list</dfn>
and an associated <dfn id="concept-mediaquerylist-document" title="concept-MediaQueryList-document">document</dfn> set on creation.</p>
<p>A <code><a href="#mediaquerylist">MediaQueryList</a></code> object has an associated <dfn id="concept-mediaquerylist-media" title="concept-MediaQueryList-media">media</dfn> which is the
<a class="external" data-anolis-spec="cssom" href="http://dev.w3.org/csswg/cssom/#serialize-a-media-query-list" title="serialize a media query list">serialized</a> form of the associated <a href="#media-query-list">media query list</a>.</p>
<p>A <code><a href="#mediaquerylist">MediaQueryList</a></code> object has an associated <dfn id="concept-mediaquerylist-matches" title="concept-MediaQueryList-matches">matches state</dfn> which is
true if the associated <a href="#media-query-list">media query list</a> matches the state of the <a href="#concept-mediaquerylist-document" title="concept-MediaQueryList-document">document</a>, and false otherwise.</p>
<!--XXX update the matches state when flushing layout (offsetWidth et al), without firing a change event. -->
<p>When asked to <dfn id="evaluate-media-queries-and-report-changes">evaluate media queries and report changes</dfn> for a <code class="external" data-anolis-spec="dom"><a href="https://dom.spec.whatwg.org/#document">Document</a></code> <var>doc</var>, run these steps:
<ol>
<li>
<p>For each <code><a href="#mediaquerylist">MediaQueryList</a></code> object <var>target</var> that has <var>doc</var> as its <a href="#concept-mediaquerylist-document" title="concept-MediaQueryList-document">document</a>,
in the order they were created, oldest first, run these substeps:
<ol>
<li><p>If <var>target</var>'s <a href="#concept-mediaquerylist-matches" title="concept-MediaQueryList-matches">matches state</a> has changed since the last time these steps were run,
<a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#concept-event-dispatch" title="concept-event-dispatch">dispatch</a> a new <a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#concept-event" title="concept-event">event</a> to <var>target</var>
using the <code><a href="#mediaquerylistevent">MediaQueryListEvent</a></code> interface,
with its <code class="external" data-anolis-spec="dom" title="dom-Event-type"><a href="https://dom.spec.whatwg.org/#dom-event-type">type</a></code> attribute initialized to <code title="">change</code>,
its <code class="external" data-anolis-spec="dom" title="dom-Event-isTrusted"><a href="https://dom.spec.whatwg.org/#dom-event-istrusted">isTrusted</a></code> attribute initialized to true,
its <code title="dom-MediaQueryListEvent-media"><a href="#dom-mediaquerylistevent-media">media</a></code> attribute initialized to <var>target</var>'s <a href="#concept-mediaquerylist-media" title="concept-MediaQueryList-media">media</a>,
and its <code title="dom-MediaQueryListEvent-matches"><a href="#dom-mediaquerylistevent-matches">matches</a></code> attribute initialized to <var>target</var>'s <a href="#concept-mediaquerylist-matches" title="concept-MediaQueryList-matches">matches state</a>. <!--fingerprint-->
</ol>
</ol>
<div class="example">
<p>A simple piece of code that detects changes in the orientation of the viewport can be written as follows:</p>
<pre>function handleOrientationChange(event) {
if(event.matches) // landscape
…
else
…
}
var mql = matchMedia("(orientation:landscape)")
mql.onchange = handleOrientationChange</pre>
</div>
<pre class="idl">interface <dfn id="mediaquerylist">MediaQueryList</dfn> : <a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#eventtarget">EventTarget</a> {
readonly attribute DOMString <a href="#dom-mediaquerylist-media" title="dom-MediaQueryList-media">media</a>;
readonly attribute boolean <a href="#dom-mediaquerylist-matches" title="dom-MediaQueryList-matches">matches</a>;
void <a href="#dom-mediaquerylist-addlistener" title="dom-MediaQueryList-addListener">addListener</a>(<a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#eventlistener">EventListener</a>? listener);
void <a href="#dom-mediaquerylist-removelistener" title="dom-MediaQueryList-removeListener">removeListener</a>(<a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#eventlistener">EventListener</a>? listener);
attribute <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">EventHandler</a> onchange;
};</pre>
<p>The <dfn id="dom-mediaquerylist-media" title="dom-MediaQueryList-media"><code>media</code></dfn> attribute must return
the associated <a href="#concept-mediaquerylist-media" title="concept-MediaQueryList-media">media</a>.</p>
<p>The <dfn id="dom-mediaquerylist-matches" title="dom-MediaQueryList-matches"><code>matches</code></dfn> attribute must return
the associated <a href="#concept-mediaquerylist-matches" title="concept-MediaQueryList-matches">matches state</a>. <!--fingerprint--></p>
<p>The <dfn id="dom-mediaquerylist-addlistener" title="dom-MediaQueryList-addListener"><code>addListener(<var>listener</var>)</code></dfn> method must run these steps:</p>
<ol>
<li><p>If <var title="">listener</var> is null, terminate these steps.
<li><p>Append an <a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#concept-event-listener" title="concept-event-listener">event listener</a>
to the associated list of
<a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#concept-event-listener" title="concept-event-listener">event listeners</a> with <b>type</b>
set to <code title="">change</code>, <b>callback</b> set to <var title="">listener</var>, and
<b>capture</b> set to false, unless there
already is an <a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#concept-event-listener" title="concept-event-listener">event listener</a> in
that list with the same <b>type</b>, <b>callback</b>, and <b>capture</b>.
</ol>
<p>The <dfn id="dom-mediaquerylist-removelistener" title="dom-MediaQueryList-removeListener"><code>removeListener(<var>listener</var>)</code></dfn> method must run these steps:</p>
<ol>
<li><p>Remove an <a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#concept-event-listener" title="concept-event-listener">event listener</a>
from the associated list of
<a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#concept-event-listener" title="concept-event-listener">event listeners</a>, whose
<b>type</b> is <code title="">change</code>, <b>callback</b> is <var title="">listener</var>, and
<b>capture</b> is false.</p>
</ol>
<p class="note">This specification initially had a custom callback mechanism with <code title="dom-MediaQueryList-addListener"><a href="#dom-mediaquerylist-addlistener">addListener</a></code> and
<code title="dom-MediaQueryList-removeListener"><a href="#dom-mediaquerylist-removelistener">removeListener</a></code>, and the callback was invoked with the associated media query list as argument.
Now the normal event mechanism is used instead.
For backwards compatibility, the <code title="dom-MediaQueryList-addListener"><a href="#dom-mediaquerylist-addlistener">addListener</a></code> and <code title="dom-MediaQueryList-removeListener"><a href="#dom-mediaquerylist-removelistener">removeListener</a></code> methods
are basically aliases for <code class="external" data-anolis-spec="dom" title="dom-EventTarget-addEventListener"><a href="https://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener">addEventListener</a></code> and <code class="external" data-anolis-spec="dom" title="dom-EventTarget-removeEventListener"><a href="https://dom.spec.whatwg.org/#dom-eventtarget-removeeventlistener">removeEventListener</a></code>, respectively,
and the <code title="">change</code> event masquerades as a <code><a href="#mediaquerylist">MediaQueryList</a></code>.</p>
<p>The following are the <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handlers">event handlers</a>
(and their corresponding <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-event-type" title="event handler event type">event handler event types</a>) that must be supported,
as <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-idl-attributes">event handler IDL attributes</a>, by all objects implementing the <code><a href="#mediaquerylist">MediaQueryList</a></code> interface:</p>
<table class="complex data">
<thead>
<tr>
<th><a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handlers" title="event handlers">Event handler</a></th>
<th><a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-event-type">Event handler event type</a></th>
</tr>
</thead>
<tbody>
<tr>
<td><dfn id="handler-mediaquerylist-onchange" title="handler-MediaQueryList-onchange">onchange</dfn>
<td><code title="">change</code>
</tr>
</tbody>
</table>
<pre class="idl">[<a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#concept-event-constructor" title="concept-event-constructor">Constructor</a>(DOMString type, optional <a href="#mediaquerylisteventinit">MediaQueryListEventInit</a> eventInitDict)]
interface <dfn id="mediaquerylistevent">MediaQueryListEvent</dfn> : <a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#event">Event</a> {
readonly attribute DOMString <a href="#dom-mediaquerylistevent-media" title="dom-MediaQueryListEvent-media">media</a>;
readonly attribute boolean <a href="#dom-mediaquerylistevent-matches" title="dom-MediaQueryListEvent-matches">matches</a>;
};
dictionary <dfn id="mediaquerylisteventinit">MediaQueryListEventInit</dfn> : <a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#eventinit">EventInit</a> {
DOMString media = "";
boolean matches = false;
};</pre>
<p>The <dfn id="dom-mediaquerylistevent-media" title="dom-MediaQueryListEvent-media"><code>media</code></dfn> attribute must return the value it was initialized to.</p>
<p>The <dfn id="dom-mediaquerylistevent-matches" title="dom-MediaQueryListEvent-matches"><code>matches</code></dfn> attribute must return the value it was initialized to.</p>
<h3 id="the-screen-interface"><span class="secno">5.3 </span>The <code title="">Screen</code> Interface</h3>
<p>As its name suggests, the <code><a href="#screen">Screen</a></code> interface represents information about the screen of the output device.</p>
<pre class="idl">interface <dfn id="screen">Screen</dfn> {
readonly attribute double <a href="#dom-screen-availwidth" title="dom-Screen-availWidth">availWidth</a>;
readonly attribute double <a href="#dom-screen-availheight" title="dom-Screen-availHeight">availHeight</a>;
readonly attribute double <a href="#dom-screen-width" title="dom-Screen-width">width</a>;
readonly attribute double <a href="#dom-screen-height" title="dom-Screen-height">height</a>;
readonly attribute unsigned long <a href="#dom-screen-colordepth" title="dom-Screen-colorDepth">colorDepth</a>;
readonly attribute unsigned long <a href="#dom-screen-pixeldepth" title="dom-Screen-pixelDepth">pixelDepth</a>;
};</pre>
<p>The <dfn id="dom-screen-availwidth" title="dom-Screen-availWidth"><code>availWidth</code></dfn> attribute must return the available width of the rendering surface of the output device,
in CSS pixels. <!--fingerprint--></p>
<p>The <dfn id="dom-screen-availheight" title="dom-Screen-availHeight"><code>availHeight</code></dfn> attribute must return the available height of the rendering surface of the output
device, in CSS pixels. <!--fingerprint--></p>
<p>The <dfn id="dom-screen-width" title="dom-Screen-width"><code>width</code></dfn> attribute must return the width of the output device, in CSS pixels. <!--fingerprint--></p>
<p>The <dfn id="dom-screen-height" title="dom-Screen-height"><code>height</code></dfn> attribute must return the height of the output device, in CSS pixels. <!--fingerprint--></p>