Title: CSSOM View Module
ED: https://drafts.csswg.org/cssom-view/
TR: https://www.w3.org/TR/cssom-view-1/
Previous Version: https://www.w3.org/TR/2016/WD-cssom-view-1-20160317/
Previous Version: https://www.w3.org/TR/2013/WD-cssom-view-20131217/
Previous Version: https://www.w3.org/TR/2011/WD-cssom-view-20110804/
Previous Version: https://www.w3.org/TR/2009/WD-cssom-view-20090804/
Previous Version: https://www.w3.org/TR/2008/WD-cssom-view-20080222/
Previous Version: https://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/
Group: CSSWG
Status: WD
Date: 2025-09-16
Prepare for TR: yes
Work Status: Revising
Shortname: cssom-view
Level: 1
Editor: Simon Fraser, Apple Inc http://www.apple.com/, simon.fraser@apple.com, w3cid 44066
Editor: Emilio Cobos Álvarez 106537, Mozilla https://mozilla.org, emilio@mozilla.com
Former Editor: Simon Pieters, Opera Software AS http://www.opera.com, simonp@opera.com
Former Editor: Glenn Adams, Cox Communications, Inc. http://www.cox.com, glenn.adams@cos.com, http://www.w3.org/wiki/User:Gadams
Former Editor: Anne van Kesteren, Opera Software ASA http://www.opera.com, annevk@annevk.nl, https://annevankesteren.nl/
!Legacy issues list: Bugzilla
Abstract: 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.
Ignored Vars: rect, point, quad
WPT Path Prefix: css/cssom-view/
WPT Display: open
Include Can I Use Panels: true
Can I Use URL: https://drafts.csswg.org/cssom-view-1/
Can I Use URL: https://www.w3.org/TR/cssom-view-1/
Ignore Can I Use URL Failure: https://drafts.csswg.org/cssom-view-1/
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
some new features which allow for scroll customization.
idlharness.html
Terminology
Terminology used in this specification is from
DOM,
CSSOM and
HTML.
[[!DOM]]
[[!CSSOM]]
[[!HTML]]
An element body (which will be the body element) is
potentially scrollable if all of the following conditions are true:
* body has an associated [=CSS/box=].
* body's parent element's computed value of the 'overflow-x' or 'overflow-y' properties is neither ''overflow/visible'' nor ''overflow/clip''.
* body's computed value of the 'overflow-x' or 'overflow-y' properties is neither ''overflow/visible'' nor ''overflow/clip''.
Note: A <{body}> element that is potentially scrollable might not have a scrolling box.
For instance, it could have a used value of 'overflow' being ''overflow/auto'' but not have its content overflowing its content area.
A scrolling box of a viewport or element has two overflow directions, which are the block-end and inline-end directions for that viewport or element.
Note that the initial scroll position might not be aligned with the [=scrolling area origin=]
depending on the [=content-distribution properties=], see [[css-align-3#overflow-scroll-position]].
The term scrolling area refers to a box of a viewport or an element that has the following edges, depending on the
viewport’s or element's scrolling box’soverflow directions.
The right-most edge of the element's right padding edge and the right margin
edge of all of the element's descendants' boxes,
excluding boxes that have an ancestor of the element as their containing block.
bottom edge
The bottom-most edge of the element's bottom padding edge and the bottom margin
edge of all of the element's descendants'
boxes, excluding boxes that have an ancestor of the element as their containing block.
The bottom-most edge of the element's bottom padding edge and the bottom margin
edge of all of the element's descendants' boxes, excluding boxes that have an ancestor of
the element as their containing block.
left edge
The left-most edge of the element's left padding edge and the left margin
edge of all of the element's descendants' boxes, excluding boxes that have an ancestor of
the element as their containing block.
The top-most edge of the element's top padding edge and the top margin edge
of all of the element's descendants' boxes, excluding boxes that have an ancestor of the
element as their containing block.
The left-most edge of the element's left padding edge and the left margin
edge of all of the element's descendants' boxes, excluding boxes that have an ancestor of
the element as their containing block.
The top-most edge of the element's top padding edge and the top margin edge
of all of the element's descendants' boxes, excluding boxes that have an ancestor of the
element as their containing block.
right edge
The right-most edge of the element's right padding edge and the right margin
edge of all of the element's descendants' boxes, excluding boxes that have an ancestor of
the element as their containing block.
The origin of a scrolling area is
the origin of the initial containing block if the scrolling area is a viewport,
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.
The beginning edges of a particular set of edges of a box or element are the following edges:
The visual viewport is a kind of viewport whose scrolling area is another viewport,
called the layout viewport.
In addition to scrolling, the visual viewport may also apply a scale transform to its layout viewport.
This transform is applied to the canvas of the layout viewport and does not affect its internal coordinate space.
Note: The scale transform of the visual viewport is often referred to as "pinch-zoom". Conceptually, this transform
changes the size of the CSS reference pixel but changes the size of the layout viewport proportionally so that it
does not cause reflow of the page's contents.
The magnitude of the scale transform is known as the visual viewport's scale factor.
This animation shows an example of a zoomed in visual viewport being "panned" around (for
example, by a user performing a touch drag). The page is scaled so that the layout viewport
is larger than the visual viewport.
A scroll delta is applied to the visual viewport first. When the visual viewport is at its
extent, scroll delta will be applied to the layout viewport. This behavior is implemented by
the [=viewport/perform a scroll=] steps.
The {{VisualViewport}} object has an associated document, which is a {{Document}} object.
It is the associated document of the owner {{Window}} of {{VisualViewport}}. The layout viewport
is the owner {{Window}}'s viewport.
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 [=CSS/box=]
(the column or column group, respectively).
The term SVG layout box refers to a [=CSS/box=] generated by an SVG element
which does not correspond to a CSS-defined 'display' type.
(Such as the [=CSS/box=] generated by a <{rect}> element.)
The term transforms refers to SVG transforms and CSS transforms. [[!SVG11]] [[!CSS-TRANSFORMS-1]]
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.
Unless otherwise stated, all string comparisons use [=string/is=].
CSS pixels
All coordinates and dimensions for the APIs defined in this
specification are in CSS pixels, unless otherwise specified. [[!CSS-VALUES]]
Note: This does not apply to e.g. {{matchMedia()}} as the units are explicitly given there.
Zooming
There are two kinds of zoom, page zoom which affects the size of the initial viewport, and the visual viewport scale factor which acts like
a magnifying glass and does not affect the initial viewport or actual viewport. [[!CSS-DEVICE-ADAPT]]
Note: The "scale factor" is often referred to as "pinch-zoom"; however, it can be affected through means other than
pinch-zooming. e.g. The user agent may zooms in on a focused input element to make it legible.
Web-exposed screen information
User agents may choose to hide information about the screen of the output device, in order to
protect the user's privacy. In order to do so in a consistent manner across APIs, this specification
defines the following terms, each having a width and a height, the origin being the top left
corner, and the x- and y-coordinates increase rightwards and downwards, respectively.
The Web-exposed screen area is one of the following:
* The area of the output device, in CSS pixels.
* The area of the viewport, in CSS pixels.
The Web-exposed available screen area is one of the following:
* The available area of the rendering surface of the output device, in CSS pixels.
* The area of the output device, in CSS pixels.
* The area of the viewport, in CSS pixels.
Common Infrastructure
This specification depends on the WHATWG Infra standard. [[!INFRA]]
Scrolling
When a user agent is to perform a scroll of a scrolling boxbox,
to a given position position,
an associated element or [=pseudo-element=] element and optionally a scroll behavior behavior
(which is "auto" if omitted),
the following steps must be run:
If the user agent honors the 'scroll-behavior' property and one of the following are true:
behavior is "auto" and element is not null and its computed value of the
'scroll-behavior' property is ''scroll-behavior/smooth''
behavior is smooth
...then perform a smooth scroll of box to position. Once the position has finished updating, emit the scrollend event.
Otherwise, perform an instant scroll of box to position. After an instant scroll emit the scrollend event.
Note: behavior: "instant" always performs an instant scroll by this algorithm.
Note: If the scroll position did not change as a result of the user interaction or programmatic invocation, where no translations were applied as a result, then no scrollend event fires because no scrolling occurred.
When a user agent is to perform a scroll of a viewport to a given position position and optionally a scroll behavior behavior
(which is "auto" if omitted) it must perform a coordinated viewport scroll by following these steps:
1. Let doc be the viewport's associated {{Document}}.
1. Let vv be the {{VisualViewport}} whose associated document is doc.
1. Let maxX be the difference between viewport's scrolling box's width and the value of vv's width attribute.
1. Let maxY be the difference between viewport's scrolling box's height and the value of vv's height attribute.
1. Let dx be the horizontal component of position - the value vv's pageLeft attribute
1. Let dy be the vertical component of position - the value of vv's pageTop attribute
1. Let visual x be the value of vv's offsetLeft attribute.
1. Let visual y be the value of vv's offsetTop attribute.
1. Let visual dx be min(maxX, max(0, visual x + dx)) - visual x.
1. Let visual dy be min(maxY, max(0, visual y + dy)) - visual y.
1. Let layout dx be dx - visual dx
1. Let layout dy be dy - visual dy
1. Let element be doc's root element if there is one, null otherwise.
1. Perform a scroll of the viewport's scrolling box to its current scroll position + (layout dx, layout dy) with element as the
associated element, and behavior as the scroll behavior.
1. Perform a scroll of vv's scrolling box to its current scroll position + (visual dx, visual dy) with element as the associated
element, and behavior as the scroll behavior.
Note: Conceptually, the visual viewport is scrolled until it "bumps up" against the layout viewport
edge and then "pushes" the layout viewport by applying the scroll delta to the layout viewport.
However, the scrolls in the steps above are computed ahead of time and applied in the opposite order
so that the layout viewport is scrolled before the visual viewport. This is done for historical
reasons to ensure consistent scroll event ordering. See the example
above for a visual depiction.
The user pinch-zooms into the document and ticks their mouse wheel, requesting the user agent scroll the document down by 50px. Because the document
is pinch-zoomed in, the visual viewport has 20px of room to scroll. The user agent distributes the scroll by scrolling the visual viewport down by
20px and the layout viewport by 30px.
The user is viewing a document in a mobile user agent. The document focuses an offscreen text input element, showing a virtual keyboard which shrinks
the visual viewport. The user agent must now bring the element into view in the visual viewport. The user agent scrolls the layout viewport so that
the element is visible within it, then the visual viewport so that the element is visible to the user.
Scroll is completed when the scroll position has no more pending updates or translations and the user has completed their gesture. Scroll position updates include smooth or instant mouse wheel scrolling, keyboard scrolling, scroll-snap events, or other APIs and gestures which cause the scroll position to update and possibly interpolate. User gestures like touch panning or trackpad scrolling aren't complete until pointers or keys have released.
When a user agent is to perform a smooth scroll of a scrolling boxbox to position,
it must update the scroll position of box in a user-agent-defined fashion over a user-agent-defined amount of time. When the scroll is
completed, the scroll position of box must be position. The scroll can also
be aborted, either by an algorithm or by the user.
When a user agent is to perform an instant scroll of a scrolling boxbox to
position, it must update the scroll position of box to position.
To scroll to the beginning of the document for a document document, follow these steps:
Let viewport be the viewport that is associated with document.
If position is the same as viewport's current scroll position, and viewport does not have an ongoing
smooth scroll, abort these steps.
Perform a scroll of viewport to position,
and document's [=root element=] as the associated element, if there is one, or null otherwise.
Note: This algorithm is used when navigating to the #top fragment identifier, as defined in HTML. [[!HTML]]
interrupt-hidden-smooth-scroll.html
long_scroll_composited.html
scroll-back-to-initial-position.html
scrolling-no-browsing-context.html
scrolling-quirks-vs-nonquirks.html
smooth-scroll-in-load-event.html
smooth-scroll-nonstop.html
WebIDL values
When asked to normalize non-finite values for a value x,
if x is one of the three special floating point literal values
(Infinity, -Infinity or NaN),
then x must be changed to the value 0. [[!WEBIDL]]
When the matchMedia(query) method is invoked these steps must be run:
Let parsed media query list be the result of
parsingquery.
Return a new {{MediaQueryList}} object,
with [=this=]'s
associated Document
as the document,
with parsed media query list as its associated [=MediaQueryList/media query list=].
matchMedia-display-none-iframe.html
matchMedia.html
The screen attribute must return the {{Screen}} object
associated with the {{Window}} object.
Note: Accessing {{Window/screen}} through a {{WindowProxy}} object might yield different
results when the {{Document}} is navigated.
If the associated document is fully active, the visualViewport
attribute must return the {{VisualViewport}} object associated with the {{Window}} object's associated
document. Otherwise, it must return null.
Note: the VisualViewport object is only returned and useful for a window whose Document is currently being presented. If
a reference is retained to a VisualViewport whose associated Document is not being currently presented, the values in
that VisualViewport must not reveal any information about the browsing context.
window-screen-height-immutable.html
window-screen-height.html
window-screen-width-immutable.html
window-screen-width.html
The moveTo(x, y) method must follow these steps:
1. Optionally, return.
1. Let target be [=this=]'s [=relevant global object=]'s [=Window/browsing context=].
1. If |target| is not an [=auxiliary browsing context=] that was created by a script (as opposed to by an action of the user), then return.
1. Optionally, clamp x and y in a user-agent-defined manner so that the window does not move outside the available space.
1. Move target’s window such that the window’s top left corner is at coordinates (x, y) relative to the top left corner of the output device, measured in CSS pixels of target. The positive axes are rightward and downward.
The moveBy(x, y) method must follow these steps:
1. Optionally, return.
1. Let target be [=this=]'s [=relevant global object=]'s [=Window/browsing context=].
1. If |target| is not an [=auxiliary browsing context=] that was created by a script (as opposed to by an action of the user), then return.
1. Optionally, clamp x and y in a user-agent-defined manner so that the window does not move outside the available space.
1. Move target's window xCSS pixels of target rightward and yCSS pixels of target downward.
The resizeTo(width, height) method must follow these steps:
1. Optionally, return.
1. Let target be [=this=]'s [=relevant global object=]'s [=Window/browsing context=].
1. If |target| is not an [=auxiliary browsing context=] that was created by a script (as opposed to by an action of the user), then return.
1. Optionally, clamp width and height in a user-agent-defined manner so that the window does not get too small or bigger than the available space.
1. Resize target's window by moving its right and bottom edges such that the distance between the left and right edges of the viewport are widthCSS pixels of target and the distance between the top and bottom edges of the viewport are heightCSS pixels of target.
1. Optionally, move target's window in a user-agent-defined manner so that it does not grow outside the available space.
resizeTo-negative.html
The resizeBy(x, y) method must follow these steps:
1. Optionally, return.
1. Let target be [=this=]'s [=relevant global object=]'s [=Window/browsing context=].
1. If |target| is not an [=auxiliary browsing context=] that was created by a script (as opposed to by an action of the user), then return.
1. Optionally, clamp x and y in a user-agent-defined manner so that the window does not get too small or bigger than the available space.
1. Resize target's window by moving its right edge xCSS pixels of target rightward and its bottom edge yCSS pixels of target downward.
1. Optionally, move target's window in a user-agent-defined manner so that it does not grow outside the available space.
The innerWidth attribute must return the viewport width including the size of a rendered
scroll bar (if any), or zero if there is no viewport.
The following snippet shows how to obtain the width of the viewport:
var viewportWidth = innerWidth
The innerHeight attribute must return the viewport height including the size of a rendered
scroll bar (if any), or zero if there is no viewport.
The scrollX attribute must return the x-coordinate,
relative to the initial containing block origin,
of the left of the viewport,
or zero if there is no viewport.
The pageXOffset attribute must return the value returned by the {{scrollX}} attribute.
The scrollY attribute must return the y-coordinate,
relative to the initial containing block origin,
of the top of the viewport,
or zero if there is no viewport.
The pageYOffset attribute must return the value returned by the {{scrollY}} attribute.
When the scroll() method is invoked these
steps must be run:
1. If invoked with one argument, follow these substeps:
1. Let options be the argument.
1. Let x be the value of the {{ScrollToOptions/left}} dictionary member of options, if present,
or the viewport’s current scroll position on the x axis otherwise.
1. Let y be the value of the {{ScrollToOptions/top}} dictionary member of options, if present,
or the viewport’s current scroll position on the y axis otherwise.
1. If invoked with two arguments, follow these substeps:
1. Let options be null converted to a {{ScrollToOptions}} dictionary. [[!WEBIDL]]
1. Let x and y be the arguments, respectively.
1. Normalize non-finite values for x and y.
1. If there is no viewport, abort these steps.
1. Let viewport width be the width of the viewport excluding the width of the scroll bar, if any.
1. Let viewport height be the height of the viewport excluding the height of the scroll bar, if any.
1.
1. Let position be the scroll position the viewport would have
by aligning the x-coordinate x of the viewportscrolling area
with the left of the viewport
and aligning the y-coordinate y of the viewportscrolling area
with the top of the viewport.
1. If position is the same as the viewport’s current scroll position,
and the viewport does not have an ongoing smooth scroll, abort these steps.
1. Let document be the viewport’s associated {{Document}}.
1. Perform a scroll of the viewport to position,
document's [=root element=] as the associated element, if there is one, or null otherwise,
and the scroll behavior being the value of the {{ScrollOptions/behavior}} dictionary member of options.
Issue: User agents do not agree whether this uses the (coordinated) viewportperform a scroll or the
scrolling boxperform a scroll on the layout viewport's scrolling box.
add-background-attachment-fixed-during-smooth-scroll.html
HTMLBody-ScrollArea_quirksmode.html
window-scroll-arguments.html
When the scrollTo() method is invoked, the
user agent must act as if the {{Window/scroll()}} method was invoked with the same arguments.
background-change-during-smooth-scroll.html
scrollTo-zoom.html
When the scrollBy() method is invoked, the
user agent must run these steps:
1. If invoked with two arguments, follow these substeps:
1. Let options be null converted to a {{ScrollToOptions}} dictionary. [[!WEBIDL]]
1. Let x and y be the arguments, respectively.
1. Let the {{ScrollToOptions/left}} dictionary member of options have the value x.
1. Let the {{ScrollToOptions/top}} dictionary member of options have the value y.
1. Normalize non-finite values for the {{ScrollToOptions/left}} and {{ScrollToOptions/top}} dictionary members of options.
1. Add the value of {{scrollX}} to the {{ScrollToOptions/left}} dictionary member.
1. Add the value of {{scrollY}} to the {{ScrollToOptions/top}} dictionary member.
1. Act as if the {{Window/scroll()}} method was invoked with options as the only argument.
The screenX and screenLeft attributes must return the x-coordinate,
relative to the origin of the Web-exposed screen area, of the left of
the client window as number of CSS pixels, or zero if there is no such
thing.
screenLeftTop.html
The screenY and screenTop attributes must return the y-coordinate,
relative to the origin of the screen of the Web-exposed screen area, of the top of
the client window as number of CSS pixels, or zero if there is no such
thing.
The outerWidth attribute must return the width of the
client window. If there is no client window this
attribute must return zero.
The outerHeight attribute must return the height of the
client window. If there is no client window this
attribute must return zero.
The devicePixelRatio attribute must return the result of the following determine the device pixel ratio algorithm:
1. If there is no output device, return 1 and abort these steps.
1. Let CSS pixel size be the size of a CSS pixel at the current page zoom and using a scale factor of 1.0.
1. Let device pixel size be the vertical size of a device pixel of the output device.
1. Return the result of dividing CSS pixel size by device pixel size.
The features argument to the {{Window/open()}} method
HTML defines the {{Window/open()}} method. This section defines behavior for position and size given
in the features argument. [[!HTML]]
To set up browsing context features for a browsing context target given a
maptokenizedFeatures:
1. Let x be null.
1. Let y be null.
1. Let width be null.
1. Let height be null.
1. If tokenizedFeatures["left"]
exists:
1. Set x to the result of invoking the rules for parsing integers on
tokenizedFeatures["left"].
1. If x is an error, set x to 0.
1. Optionally, clamp x in a user-agent-defined manner so that the window does not
move outside the Web-exposed available screen area.
1. Optionally, move target's window such that the window's left edge is at the
horizontal coordinate x relative to the left edge of the Web-exposed screen
area, measured in CSS pixels of target. The positive axis is rightward.
1. If tokenizedFeatures["top"]
exists:
1. Set y to the result of invoking the rules for parsing integers on
tokenizedFeatures["top"].
1. If y is an error, set y to 0.
1. Optionally, clamp y in a user-agent-defined manner so that the window does not
move outside the Web-exposed available screen area.
1. Optionally, move target's window such that the window's top edge is at the
vertical coordinate y relative to the top edge of the Web-exposed screen
area, measured in CSS pixels of target. The positive axis is downward.
1. If tokenizedFeatures["width"]
exists:
1. Set width to the result of invoking the rules for parsing integers on
tokenizedFeatures["width"].
1. If width is an error, set width to 0.
1. If width is not 0:
1. Optionally, clamp width in a user-agent-defined manner so that the window does
not get too small or bigger than the Web-exposed available screen area.
1. Optionally, size target's window by moving its right edge such that the
distance between the left and right edges of the viewport are widthCSS pixels of target.
1. Optionally, move target's window in a user-agent-defined manner so that it
does not grow outside the Web-exposed available screen area.
1. If tokenizedFeatures["height"]
exists:
1. Set height to the result of invoking the rules for parsing integers on
tokenizedFeatures["height"].
1. If height is an error, set height to 0.
1. If height is not 0:
1. Optionally, clamp height in a user-agent-defined manner so that the window
does not get too small or bigger than the Web-exposed available screen area.
1. Optionally, size target's window by moving its bottom edge such that the
distance between the top and bottom edges of the viewport are heightCSS pixels of target.
1. Optionally, move target's window in a user-agent-defined manner so that it
does not grow outside the Web-exposed available screen area.
A supported open() feature name is one of the following:
width
The width of the viewport.
height
The height of the viewport.
left
The left position of the window.
top
The top position of the window.
The {{MediaQueryList}} Interface
This section integrates with the event loop defined in HTML. [[!HTML]]
A {{MediaQueryList}} object has an associated media query list
and an associated document set on creation.
A {{MediaQueryList}} object has an associated media which is the
serialized form of the associated [=MediaQueryList/media query list=].
A {{MediaQueryList}} object has an associated matches state which is
true if the associated [=MediaQueryList/media query list=] matches the state of the document, and false otherwise.
When asked to evaluate media queries and report changes for a {{Document}} doc, run these steps:
For each {{MediaQueryList}} object target that has doc as its document,
in the order they were created, oldest first, run these substeps:
If target's matches state has changed since the last time these steps were run,
fire an event named change at target
using {{MediaQueryListEvent}},
with its {{Event/isTrusted}} attribute initialized to true,
its {{MediaQueryList/media}} attribute initialized to target's media,
and its {{MediaQueryListEvent/matches}} attribute initialized to target's matches state.
A simple piece of code that detects changes in the orientation of the viewport can be written as follows:
function handleOrientationChange(event) {
if(event.matches) // landscape
…
else
…
}
var mql = matchMedia("(orientation:landscape)");
mql.onchange = handleOrientationChange;
The media attribute must return
the associated media.
The matches attribute must return
the associated matches state.
The addListener(callback) method,
when invoked, must run these steps:
1. Add an event listener with [=this=]
and an event listener whose
type is change,
and callback is |callback|.
The removeListener(callback) method,
when invoked, must run these steps:
1. If [=this=]’s event listener listcontains an event listener whose
type is change,
callback is |callback|,
and capture is false,
then remove an event listener with
[=this=] and that event listener.
Note: This specification initially had a custom callback mechanism with {{addListener()}} and
{{removeListener()}}, 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 {{addListener()}} and {{removeListener()}} methods
are basically aliases for {{addEventListener()}} and {{removeEventListener()}}, respectively,
and the change event masquerades as a {{MediaQueryList}}.
The following are the event handlers
(and their corresponding event handler event types) that must be supported,
as event handler IDL attributes, by all objects implementing the {{MediaQueryList}} interface:
The media attribute must return the value it was initialized to.
The matches attribute must return the value it was initialized to.
Event summary
This section is non-normative.
Event
Interface
Interesting targets
Description
change
{{MediaQueryListEvent}}
{{MediaQueryList}}
Fired at the {{MediaQueryList}} when the matches state changes.
The {{Screen}} Interface
As its name suggests, the {{Screen}} interface represents information about the screen of the output device.
[Exposed=Window]
interface Screen {
readonly attribute long availWidth;
readonly attribute long availHeight;
readonly attribute long width;
readonly attribute long height;
readonly attribute unsigned long colorDepth;
readonly attribute unsigned long pixelDepth;
};
The availWidth attribute must return the width of the Web-exposed
available screen area.
The availHeight attribute must return the height of the
Web-exposed available screen area.
The width attribute must return the width of the Web-exposed
screen area.
The height attribute must return the height of the Web-exposed
screen area.
The colorDepth and pixelDepth attributes should return the number of bits
allocated to colors for a pixel in the output device, excluding the alpha
channel. If the user agent is not able to return the number of bits used by the
output device, it should return the closest estimation such as, for example, the
number of bits used by the frame buffer sent to the display or any internal
representation that would be the closest to the value the output device would
use. The user agent must return a value for these attributes at least equal to
the value of the '@media/color' media feature multiplied by three. If the different
color components are not represented with the same number of bits, the returned
value may be greater than three times the value of the '@media/color' media feature. If the user
agent does not know the color depth or does not want to return it for privacy
considerations, it should return 24.
Note: The {{colorDepth}} and {{pixelDepth}} attributes return the same value for
compatibility reasons.
Note: Some non-conforming implementations are known to return 32 instead of 24.
cssom-view-window-screen-interface.html
screen-detached-frame.html
Screen-pixelDepth-Screen-colorDepth001.html
The elementFromPoint(x, y) method must follow these steps:
1. If either argument is negative, x is greater than the viewport width excluding the size of a rendered scroll bar (if any), or
y is greater than the viewport height excluding the size of a rendered scroll bar (if any), or there is no viewport
associated with the document, return null and terminate these steps.
1. If there is a [=CSS/box=] in the viewport that would be a target for hit testing at coordinates x,y,
when applying the transforms that apply to the descendants of the viewport, return the associated element and terminate these steps.
1. If the document has a [=root element=], return the [=root element=] and terminate these steps.
1. Return null.
Note: The {{elementFromPoint()}} method does not necessarily return the top-most painted element. For
instance, an element can be excluded from being a target for hit testing by using the 'pointer-events' CSS property.
elementFromPoint-001.html
elementFromPoint-002.html
elementFromPoint-003.html
elementFromPoint-dynamic-anon-box.html
elementFromPoint-ellipsis-in-inline-box.html
elementFromPoint-float-in-relative.html
elementFromPoint-float-in-table.html
elementFromPoint-list-001.html
elementFromPoint-mixed-font-sizes.html
elementFromPoint-parameters.html
elementFromPoint-subpixel.html
elementFromPoint-visibility-hidden-resizer.html
elementFromPoint.html
elementFromPosition.html
negativeMargins.html
The elementsFromPoint(x, y) method must follow these steps:
1. Let sequence be a new empty sequence.
1. If either argument is negative, x is greater than the viewport width excluding the size of a rendered scroll bar (if any), or
y is greater than the viewport height excluding the size of a rendered scroll bar (if any), or there is no viewport
associated with the document, return sequence and terminate these steps.
1. For each [=CSS/box=] in the viewport, in paint order, starting with the topmost box, that would be a target for hit testing at
coordinates x,y even if nothing would be overlapping it, when applying the transforms that apply to the descendants of the
viewport, append the associated element to sequence.
1. If the document has a [=root element=], and the last item in sequence is not the [=root element=], append the [=root element=] to sequence.
1. Return sequence.
elementsFromPoint-iframes.html
elementsFromPoint-inline-htb-ltr.html
elementsFromPoint-inline-htb-rtl.html
elementsFromPoint-inline-vlr-ltr.html
elementsFromPoint-inline-vlr-rtl.html
elementsFromPoint-inline-vrl-ltr.html
elementsFromPoint-inline-vrl-rtl.html
elementsFromPoint-invalid-cases.html
elementsFromPoint-shadowroot.html
elementsFromPoint-simple.html
elementsFromPoint-svg-text.html
elementsFromPoint-svg.html
elementsFromPoint-table.html
elementsFromPoint.html
The caretPositionFromPoint(x, y, options) method must return the
result of running these steps:
1. If there is no viewport associated with the document, return null.
1. If either argument is negative, x is greater
than the viewport width excluding the size of a rendered
scroll bar (if any), y is greater than the
viewport height excluding the size of a rendered scroll bar
(if any) return null.
1. If at the coordinates x,y
in the viewport no text insertion point indicator would have
been inserted when applying the transforms that apply to the descendants of the viewport, return null.
1. If at the coordinates x,y
in the viewport a text insertion point indicator would have
been inserted in a text entry widget which is also a replaced element, when applying the transforms that apply to the descendants of the
viewport, return a caret position with its properties set as follows:
The amount of 16-bit units to the left of where the
text insertion point indicator would have inserted.
1. Otherwise:
1. Let caretPosition be a tuple consisting of a caretPositionNode (a node) and a caretPositionOffset (a non-negative integer) for the position where the text insertion point indicator would have been inserted when applying
the transforms that apply to the descendants of the viewport.
1. Let startNode be the caretPositionNode of the caretPosition, and let startOffset be the caretPositionOffset of the caretPosition.
1. While startNode is a [=node=], startNode's [=tree/root=] is a [=shadow root=], and startNode's [=tree/root=] is not a [=shadow-including inclusive ancestor=] of any of options["{{CaretPositionFromPointOptions/shadowRoots}}"], repeat these steps:
1. Set startOffset to [=tree/index=] of startNode's [=tree/root=]'s [=host=].
1. Set startNode to startNode's [=tree/root=]'s [=host=]'s [=tree/parent=].
1. Return a caret position with its properties set as follows:
1. caret node is set to startNode.
1. caret offset is set to startOffset.
Note: This caret position is not live.
Note: The specifics of hit testing are out of scope of this
specification and therefore the exact details of
{{elementFromPoint()}} and {{caretPositionFromPoint()}}
are therefore too. Hit testing will hopefully be defined in a future
revision of CSS or HTML.
The scrollingElement attribute, on getting, must run these steps:
1. If the {{Document}} is in quirks mode, follow these substeps:
1. If the body element exists, and it is not potentially scrollable, return the body element and abort these steps.
For this purpose,
a value of ''overflow:clip'' on the the body element's parent element
must be treated as ''overflow:hidden''.
1. Return null and abort these steps.
1. If there is a [=root element=], return the [=root element=] and abort these steps.
1. Return null.
Note: For non-conforming user agents that always use the quirks mode behavior for {{Element/scrollTop}}
and {{Element/scrollLeft}}, the {{Document/scrollingElement}} attribute is expected to also always return
the body element (or null if it does not exist).
This API exists so that Web developers can use it to get the right element to use for scrolling APIs,
without making assumptions about a particular user agent's behavior
or having to invoke a scroll to see which element scrolls the viewport.
Note: the body element is different from HTML's document.body
in that the latter can return a frameset element.
scroll-overflow-clip-quirks-001.html
scroll-overflow-clip-quirks-002.html
scrollingElement-quirks-dynamic-001.html
scrollingElement-quirks-dynamic-002.html
scrollingElement.html
The {{CaretPosition}} Interface
A caret position gives the position of a text insertion point indicator. It always has an associated
caret node and caret offset. It is represented by a {{CaretPosition}} object.
The offsetNode attribute must return the caret node.
The offset attribute must return the caret offset.
The getClientRect() method must follow these steps,
aborting on the first step that returns a value:
1. If caret node is a text entry widget that is a replaced element,
and that is in the document,
return a [=scaled=] {{DOMRect}} object for the caret in the widget
as represented by the caret offset value.
The transforms that apply to the element and its ancestors are applied.
1. Otherwise:
1. Let caretRange be a collapsed {{Range}} object whose [=range/start node=] and [=range/end node=] are set to caret node, and whose [=range/start offset=] and [=range/end offset=] are set to caret offset.
1. Return the {{DOMRect}} object which is the result of invoking the {{Range/getBoundingClientRect()}} method on caretRange.
Note: This {{DOMRect}} object is not live.
CaretPosition-001.html
Note: The {{CheckVisibilityOptions/checkOpacity}} and {{CheckVisibilityOptions/checkVisibilityCSS}} properties are historical names.
These properties have aliases that match the new naming scheme,
namely {{CheckVisibilityOptions/opacityProperty}} and {{CheckVisibilityOptions/visibilityProperty}}.
The getClientRects() method, when invoked, must return the result of the following algorithm:
1. If the element on which it was invoked does not have an associated [=CSS/box=] return an empty {{DOMRectList}} object and stop this algorithm.
1. If the element has an associated SVG layout box return a [=scaled=] {{DOMRectList}} object containing a single {{DOMRect}} object that describes the bounding box of the element as defined by the SVG specification, applying the transforms that apply to the element and its ancestors.
1. Return a {{DOMRectList}} object containing {{DOMRect}} objects in content order, one for each box fragment, describing its border area (including those with a height or width of zero) with the following constraints:
* Apply the transforms that apply to the element and its ancestors.
* If the element on which the method was invoked has a computed value for the 'display' property of ''table'' or ''inline-table'' include both the table box and the caption box, if any, but not the anonymous container box.
* Replace each [=anonymous=] [=block box=] with its child box(es) and repeat this until no anonymous block boxes are left in the final list.
Note: The {{DOMRect}} objects returned by {{Element/getClientRects()}} are not live.
cssom-getClientRects-002.html
cssom-getClientRects.html
DOMRectList.html
getClientRects-br-htb-ltr.html
getClientRects-br-htb-rtl.html
getClientRects-br-vlr-ltr.html
getClientRects-br-vlr-rtl.html
getClientRects-br-vrl-ltr.html
getClientRects-br-vrl-rtl.html
getClientRects-inline-atomic-child.html
getClientRects-inline-inline-child.html
getClientRects-inline.html
getClientRects-zoom.html
historical.html
ttwf-js-cssomview-getclientrects-length.html
The getBoundingClientRect() method, when
invoked on an element element, must return the result of
getting the bounding box for element.
To get the bounding box for element,
run the following steps:
1. Let list be the result of invoking {{Element/getClientRects()}} on
element.
1. If the list is empty return a {{DOMRect}} object whose {{DOMRect/x}},
{{DOMRect/y}}, {{DOMRect/width}} and {{DOMRect/height}} members are zero.
1. If all rectangles in list have zero width or height, return the first rectangle in
list.
1. Otherwise, return a {{DOMRect}} object describing the smallest rectangle that includes all
of the rectangles in list of which the height or width is not zero.
Note: The {{DOMRect}} object returned by {{Element/getBoundingClientRect()}} is not live.
The following snippet gets the dimensions of the first div element in a document:
var example = document.getElementsByTagName("div")[0].getBoundingClientRect();
var exampleWidth = example.width;
var exampleHeight = example.height;
Note: The {{Element/checkVisibility()}} method
provides a set of simple checks
for whether an element is potentially "visible".
It defaults to a very simple and straightforward method
based on the [=box tree=],
but allows for several additional checks to be opted into,
depending on what precise notion of "visibility" is desired.
The checkVisibility(|options|) method
must run these steps,
when called on an element |this|:
1. If |this| does not have an associated [=CSS/box=],
return false.
1. If an ancestor of |this| in the [=flat tree=]
has ''content-visibility: hidden'',
return false.
1. If either the {{CheckVisibilityOptions/opacityProperty}}
or the {{CheckVisibilityOptions/checkOpacity}}
dictionary members of |options|
are true,
and |this|, or an ancestor of |this| in the [=flat tree=],
has a computed 'opacity' value of ''0'',
return false.
1. If either the {{CheckVisibilityOptions/visibilityProperty}}
or the {{CheckVisibilityOptions/checkVisibilityCSS}}
dictionary members of |options|
are true,
and |this| is [=invisible=],
return false.
1. If the {{CheckVisibilityOptions/contentVisibilityAuto}} dictionary member of |options|
is true
and an ancestor of |this| in the [=flat tree=]
[=skips its contents=]
due to ''content-visibility: auto'',
return false.
1. Return true.
checkVisibility.html
The scrollIntoView(arg) method must run these steps:
1. Let behavior be "auto".
1. Let block be "start".
1. Let inline be "nearest".
1. Let container be null.
1. If arg is a {{ScrollIntoViewOptions}} dictionary, then:
1. Set behavior to the {{ScrollOptions/behavior}} dictionary member of options.
1. Set block to the {{ScrollIntoViewOptions/block}} dictionary member of options.
1. Set inline to the {{ScrollIntoViewOptions/inline}} dictionary member of options.
1. If the {{ScrollIntoViewOptions/container}} dictionary member of options is "nearest",
set container to the element.
1. Otherwise, if arg is false, then set block to "end".
1. If the element does not have any associated [=CSS/box=],
or is not available to user-agent features,
then return.
1. Scroll the element into view
with behavior, block, inline, and container.
1. Optionally perform some other action that brings the element to the user's attention.
A component can use scrollIntoView to scroll content of interest into the specified alignment:
scrollIntoView-align-scrollport-covering-child.html
scrollIntoView-container.html
scrollintoview-containingblock-chain.html
scrollIntoView-fixed-outside-of-viewport.html
scrollIntoView-fixed.html
scrollIntoView-horizontal-partially-visible.html
scrollIntoView-horizontal-tb-writing-mode-and-rtl-direction.html
scrollIntoView-horizontal-tb-writing-mode.html
scrollIntoView-inline-image.html
scrollIntoView-multiple-nested.html
scrollIntoView-multiple.html
scrollIntoView-scrolling-container.html
scrollIntoView-scrollMargin.html
scrollIntoView-scrollPadding.html
scrollIntoView-shadow.html
scrollIntoView-should-treat-slot-as-scroll-container.html
scrollIntoView-sideways-lr-writing-mode-and-rtl-direction.html
scrollIntoView-sideways-lr-writing-mode.html
scrollIntoView-sideways-rl-writing-mode-and-rtl-direction.html
scrollIntoView-sideways-rl-writing-mode.html
scrollIntoView-smooth.html
scrollIntoView-stuck.tentative.html
scrollIntoView-svg-shape.html
scrollIntoView-vertical-lr-writing-mode-and-rtl-direction.html
scrollIntoView-vertical-lr-writing-mode.html
scrollIntoView-vertical-rl-writing-mode.html
scrollintoview-zero-height-item.html
scrollintoview.html
smooth-scrollIntoView-with-smooth-fragment-scroll.html
smooth-scrollIntoView-with-unrelated-gesture-scroll.html
visual-scrollIntoView-001.html
visual-scrollIntoView-002.html
visual-scrollIntoView-003.html
The scroll() method must run these steps:
1. If invoked with one argument, follow these substeps:
1. Let options be the argument.
1. Normalize non-finite values for {{ScrollToOptions/left}} and {{ScrollToOptions/top}} dictionary members of options, if present.
1. Let x be the value of the {{ScrollToOptions/left}} dictionary member of options, if present, or the element's current scroll position on the x axis otherwise.
1. Let y be the value of the {{ScrollToOptions/top}} dictionary member of options, if present, or the element's current scroll position on the y axis otherwise.
1. If invoked with two arguments, follow these substeps:
1. Let options be null converted to a {{ScrollToOptions}} dictionary. [[!WEBIDL]]
1. Let x and y be the arguments, respectively.
1. Normalize non-finite values for x and y.
1. Let the {{ScrollToOptions/left}} dictionary member of options have the value x.
1. Let the {{ScrollToOptions/top}} dictionary member of options have the value y.
1. Let document be the element's node document.
1. If document is not the active document, terminate these steps.
1. Let window be the value of document's {{Document/defaultView}} attribute.
1. If window is null, terminate these steps.
1. If the element is the [=root element=] and document is in quirks mode, terminate these steps.
1. If the element is the [=root element=] invoke {{Window/scroll()}} on window with {{Window/scrollX}} on window as first argument and y as second argument,
and terminate these steps.
1. If the element is the body element,
document is in quirks mode,
and the element is not potentially scrollable,
invoke {{Window/scroll()}} on window with options as the only argument,
and terminate these steps.
1. If the element does not have any associated [=CSS/box=],
the element has no associated scrolling box,
or the element has no overflow,
terminate these steps.
1. Scroll the element to x,y,
with the scroll behavior being the value of the {{ScrollOptions/behavior}} dictionary member of options.
When the scrollTo() method is invoked, the
user agent must act as if the {{Element/scroll()}} method was invoked with the same arguments.
When the scrollBy() method is invoked, the
user agent must run these steps:
1. If invoked with one argument, follow these substeps:
1. Let options be the argument.
1. Normalize non-finite values for {{ScrollToOptions/left}} and {{ScrollToOptions/top}} dictionary members of options, if present.
1. If invoked with two arguments, follow these substeps:
1. Let options be null converted to a {{ScrollToOptions}} dictionary. [[!WEBIDL]]
1. Let x and y be the arguments, respectively.
1. Normalize non-finite values for x and y.
1. Let the {{ScrollToOptions/left}} dictionary member of options have the value x.
1. Let the {{ScrollToOptions/top}} dictionary member of options have the value y.
1. Add the value of {{Element/scrollLeft}} to the {{ScrollToOptions/left}} dictionary member.
1. Add the value of {{Element/scrollTop}} to the {{ScrollToOptions/top}} dictionary member.
1. Act as if the {{Element/scroll()}} method was invoked with options as the only argument.
window-scrollBy-display-change.html
The scrollTop attribute, on getting, must return the result of running these steps:
1. Let document be the element's node document.
1. If document is not the active document, return zero and terminate these steps.
1. Let window be the value of document's {{Document/defaultView}} attribute.
1. If window is null, return zero and terminate these steps.
1. If the element is the [=root element=] and document is in quirks mode, return zero and terminate these steps.
1. If the element is the [=root element=] return the value of {{Window/scrollY}} on window.
1. If the element is the body element, document is in quirks mode, and the element is not potentially scrollable, return the value of {{Window/scrollY}} on window.
1. If the element does not have any associated [=CSS/box=], return zero and terminate these steps.
1. Return the y-coordinate of the scrolling area at the alignment point with the top of the padding edge of the element.
When setting the {{Element/scrollTop}} attribute these steps must be run:
1. Let y be the given value.
1. Normalize non-finite values for y.
1. Let document be the element's node document.
1. If document is not the active document, terminate these steps.
1. Let window be the value of document's {{Document/defaultView}} attribute.
1. If window is null, terminate these steps.
1. If the element is the [=root element=] and document is in quirks mode, terminate these steps.
1. If the element is the [=root element=] invoke {{Window/scroll()}} on window with {{Window/scrollX}} on window as first argument and y as second argument, and terminate these steps.
1. If the element is the body element, document is in quirks mode, and the element is not potentially scrollable, invoke {{Window/scroll()}} on window with {{Window/scrollX}} as first argument and y as second argument, and terminate these steps.
1. If the element does not have any associated [=CSS/box=], the element has no associated scrolling box, or the element has no overflow, terminate these steps.
1. Scroll the element to {{Element/scrollLeft}},y, with the scroll behavior being "auto".
dom-element-scroll.html
elementScroll-002.html
elementScroll.html
scroll-no-layout-box.html
scroll-offsets-fractional-zoom.html
scroll-zoom.html
scrollTop-display-change.html
table-scroll-props.html
The scrollLeft attribute, on getting, must return the result of running these steps:
1. Let document be the element's node document.
1. If document is not the active document, return zero and terminate these steps.
1. Let window be the value of document's {{Document/defaultView}} attribute.
1. If window is null, return zero and terminate these steps.
1. If the element is the [=root element=] and document is in quirks mode, return zero and terminate these steps.
1. If the element is the [=root element=] return the value of {{Window/scrollX}} on window.
1. If the element is the body element, document is in quirks mode, and the element is not potentially scrollable, return the value of {{Window/scrollX}} on window.
1. If the element does not have any associated [=CSS/box=], return zero and terminate these steps.
1. Return the x-coordinate of the scrolling area at the alignment point with the left of the padding edge of the element.
When setting the {{Element/scrollLeft}} attribute these steps must be run:
1. Let x be the given value.
1. Normalize non-finite values for x.
1. Let document be the element's node document.
1. If document is not the active document, terminate these steps.
1. Let window be the value of document's {{Document/defaultView}} attribute.
1. If window is null, terminate these steps.
1. If the element is the [=root element=] and document is in quirks mode, terminate these steps.
1. If the element is the [=root element=] invoke {{Window/scroll()}} on window with x as first argument and {{Window/scrollY}} on window as second argument, and terminate these steps.
1. If the element is the body element, document is in quirks mode, and the element is not potentially scrollable, invoke {{Window/scroll()}} on window with x as first argument and {{Window/scrollY}} on window as second argument, and terminate these steps.
1. If the element does not have any associated [=CSS/box=], the element has no associated scrolling box, or the element has no overflow, terminate these steps.
1. Scroll the element to x,{{Element/scrollTop}}, with the scroll behavior being "auto".
scrollLeft-of-scroller-with-wider-scrollbar.html
scrollLeftTop.html
The scrollWidth attribute must return the result of running these steps:
1. Let document be the element's node document.
1. If document is not the active document, return zero and terminate these steps.
1. Let viewport width be the width of the viewport excluding the width of the scroll bar, if any, or zero if there is no viewport.
1. If the element is the [=root element=] and document is not in quirks mode return max(viewportscrolling area width, viewport width).
1. If the element is the body element, document is in quirks mode and the element is not potentially scrollable, return max(viewportscrolling area width, viewport width).
1. If the element does not have any associated [=CSS/box=] return zero and terminate these steps.
1. Return the width of the element's scrolling area.
pt-to-px-width.html
scrollWidthHeight-contain-layout.html
scrollWidthHeight-negative-margin-001.html
scrollWidthHeight-negative-margin-002.html
scrollWidthHeight-overflow-visible-margin-collapsing.html
scrollWidthHeight-overflow-visible-negative-margins.html
scrollWidthHeight.xht
scrollWidthHeightWhenNotScrollable.xht
The scrollHeight attribute must return the result of running these steps:
1. Let document be the element's node document.
1. If document is not the active document, return zero and terminate these steps.
1. Let viewport height be the height of the viewport excluding the height of the scroll bar, if any, or zero if there is no viewport.
1. If the element is the [=root element=] and document is not in quirks mode return max(viewportscrolling area height, viewport height).
1. If the element is the body element, document is in quirks mode and the element is not potentially scrollable, return max(viewportscrolling area height, viewport height).
1. If the element does not have any associated [=CSS/box=] return zero and terminate these steps.
1. Return the height of the element's scrolling area.
The clientTop attribute must run these steps:
1. If the element has no associated [=CSS/box=] or if the [=CSS/box=] is inline, return zero.
1. Return the [=unscaled=] computed value of the 'border-top-width' property plus the height of any scrollbar rendered between the top padding edge and the top border edge, ignoring any transforms that apply to the element and its ancestors.
client-props-inline-list-item.html
client-props-input.html
client-props-root.html
client-props-zoom.html
outer-svg.html
table-client-props.html
The clientLeft attribute must run these steps:
1. If the element has no associated [=CSS/box=] or if the [=CSS/box=] is inline, return zero.
1. Return the [=unscaled=] computed value of the 'border-left-width' property plus the width of any scrollbar rendered between the left padding edge and the left border edge, ignoring any transforms that apply to the element and its ancestors.
The clientWidth attribute must run these steps:
1. If the element has no associated [=CSS/box=] or if the [=CSS/box=] is inline, return zero.
1. If the element is the [=root element=] and the element's node document is not in quirks mode, or if the element is the body element and the element's node documentis in quirks mode, return the viewport width excluding the size of a rendered scroll bar (if any).
1. Return the [=unscaled=] width of the padding edge excluding the width of any rendered scrollbar between the padding edge and the border edge, ignoring any transforms or that apply to the element and its ancestors.
The clientHeight attribute must run these steps:
1. If the element has no associated [=CSS/box=] or if the [=CSS/box=] is inline, return zero.
1. If the element is the [=root element=] and the element's node document is not in quirks mode, or if the element is the body element and the element's node documentis in quirks mode, return the viewport height excluding the size of a rendered scroll bar (if any).
1. Return the [=unscaled=] height of the padding edge excluding the height of any rendered scrollbar between the padding edge and the border edge, ignoring any transforms that apply to the element and its ancestors.
The currentCSSZoom attribute must return the
[=effective zoom=] of the element, or 1.0 if the element isn't [=being rendered=].
Element-currentCSSZoom.html
table-border-collapse-client-width-height.html
table-border-separate-client-width-height.html
table-with-border-client-width-height.html
{{Element}} Scrolling Members
To determine the scroll-into-view position of a target, which is an Element, [=pseudo-element=], or Range,
with a scroll behavior behavior,
a block flow direction position block,
an inline base direction position inline,
and a scrolling boxscrolling box,
run the following steps:
1. Let target bounding border box be the box represented by the return value of invoking Element's {{Element/getBoundingClientRect()}}, if target is an Element, or Range's {{Range/getBoundingClientRect()}}, if target is a Range.
1. Let scrolling box edge A be the beginning edge in the block flow direction of scrolling box, and let element edge A be target bounding border box's edge on the same physical side as that of scrolling box edge A.
1. Let scrolling box edge B be the ending edge in the block flow direction of scrolling box, and let element edge B be target bounding border box's edge on the same physical side as that of scrolling box edge B.
1. Let scrolling box edge C be the beginning edge in the inline base direction of scrolling box, and let element edge C be target bounding border box's edge on the same physical side as that of scrolling box edge C.
1. Let scrolling box edge D be the ending edge in the inline base direction of scrolling box, and let element edge D be target bounding border box's edge on the same physical side as that of scrolling box edge D.
1. Let element height be the distance between element edge A and element edge B.
1. Let scrolling box height be the distance between scrolling box edge A and scrolling box edge B.
1. Let element width be the distance between element edge C and element edge D.
1. Let scrolling box width be the distance between scrolling box edge C and scrolling box edge D.
1. Let position be the scroll position scrolling box would have by following these steps:
1. If block is "start", then align element edge A with scrolling box edge A.
1. Otherwise, if block is "end", then align element edge B with scrolling box edge B.
1. Otherwise, if block is "center", then align the center of target bounding border box with the center of scrolling box in scrolling box's block flow direction.
1. Otherwise, block is "nearest":
If element edge A and element edge B are both outside scrolling box edge A and scrolling box edge B
Do nothing.
If element edge A is outside scrolling box edge A and element height is less than scrolling box height
If element edge B is outside scrolling box edge B and element height is greater than scrolling box height
Align element edge A with scrolling box edge A.
If element edge A is outside scrolling box edge A and element height is greater than scrolling box height
If element edge B is outside scrolling box edge B and element height is less than scrolling box height
Align element edge B with scrolling box edge B.
1. If inline is "start", then align element edge C with scrolling box edge C.
1. Otherwise, if inline is "end", then align element edge D with scrolling box edge D.
1. Otherwise, if inline is "center", then align the center of target bounding border box with the center of scrolling box in scrolling box's inline base direction.
1. Otherwise, inline is "nearest":
If element edge C and element edge D are both outside scrolling box edge C and scrolling box edge D
Do nothing.
If element edge C is outside scrolling box edge C and element width is less than scrolling box width
If element edge D is outside scrolling box edge D and element width is greater than scrolling box width
Align element edge C with scrolling box edge C.
If element edge C is outside scrolling box edge C and element width is greater than scrolling box width
If element edge D is outside scrolling box edge D and element width is less than scrolling box width
To scroll a target into view target, which is an Element, [=pseudo-element=], or Range,
with a scroll behavior behavior,
a block flow direction position block,
an inline base direction position inline,
and an optional containing Element to stop scrolling after reaching container,
means to run these steps:
1. For each ancestor element or viewport that establishes a scrolling boxscrolling box,
in order of innermost to outermost scrolling box, run these substeps:
1. If the {{Document}} associated with target is not same origin with the {{Document}} associated with the element or viewport associated with scrolling box, terminate these steps.
1. Let position be the scroll position resulting from running the steps to determine the scroll-into-view position of target with behavior as the |scroll behavior|,
block as the |block flow position|, inline as the |inline base direction position| and scrolling box as the |scrolling box|.
1. If position is not the same as scrolling box's current scroll position, or scrolling box has an ongoing smooth scroll,
1.
If scrolling box is associated with an element
Perform a scroll of the element's scrolling box to position, with the element as the associated element and
behavior as the scroll behavior.
1. Let document be the viewport’s associated {{Document}}.
1. Let root element be document's [=root element=], if there is one, or null otherwise.
1. Perform a scroll of the viewport to position, with root element as the associated element and behavior
as the scroll behavior.
1. If container is not null and either scrolling box
is a [=shadow-including inclusive ancestor=] of container or
is a viewport whose document is a [=shadow-including inclusive ancestor=] of container,
abort the rest of these steps.
To scroll an element (or [=pseudo-element=]) element to x,y optionally with a scroll behavior behavior (which is "auto" if omitted) means to:
1. Let box be element's associated scrolling box.
1.
1. Let position be the scroll position box would have by aligning scrolling area x-coordinate x with the left of box and aligning scrolling area y-coordinate y with the top of box.
1. If position is the same as box's current scroll position, and box does not have an ongoing smooth scroll, abort these steps.
1. Perform a scroll of box to position, element as the associated element and behavior as the scroll behavior.
Extensions to the {{HTMLElement}} Interface
partial interface HTMLElement {
readonly attribute Element? scrollParent;
readonly attribute Element? offsetParent;
readonly attribute long offsetTop;
readonly attribute long offsetLeft;
readonly attribute long offsetWidth;
readonly attribute long offsetHeight;
};
The scrollParent attribute must return the result of running these steps:
1. If any of the following holds true, return null and terminate this algorithm:
* The element does not have an associated [=CSS/box=].
* The element is the [=root element=].
* The element is the body element.
* The element's computed value of the 'position' property is ''position/fixed'' and no ancestor establishes a fixed position [=containing block=].
1. Let ancestor be the [=containing block=] of the element in the flat tree and repeat these substeps:
1. If ancestor is the [=initial containing block=], return the {{Document/scrollingElement}} for the element's document if it is not closed-shadow-hidden from the element, otherwise return null.
1. If ancestor is not closed-shadow-hidden from the element, and is a scroll container, terminate this algorithm and return ancestor.
1. If the computed value of the 'position' property of ancestor is ''position/fixed'', and no ancestor establishes a fixed position [=containing block=], terminate this algorithm and return null.
1. Let ancestor be the [=containing block=] of ancestor in the flat tree.
scrollParent-shadow-tree.html
scrollParent.html
The offsetParent attribute must return the result of running these steps:
1. If any of the following holds true return null and terminate this algorithm:
* The element does not have an associated [=CSS/box=].
* The element is the [=root element=].
* The element is the body element.
* The element's computed value of the 'position' property is ''position/fixed'' and no ancestor establishes a fixed position [=containing block=].
1. Let ancestor be the parent of the element in the flat tree and repeat these substeps:
1. If ancestor is closed-shadow-hidden from the element, its computed value of the 'position' property is ''position/fixed'', and no ancestor establishes a fixed position [=containing block=], terminate this algorithm and return null.
1. If ancestor is not closed-shadow-hidden from the element and satisfies at least one of the following, terminate this algorithm and return ancestor.
* The element is in a fixed position [=containing block=], and ancestor is a containing block for fixed-positioned descendants.
* The element is not in a fixed position [=containing block=], and:
* ancestor is a containing block of absolutely-positioned descendants (regardless of whether there are any absolutely-positioned descendants).
* It is the body element.
* The computed value of the 'position' property of the element is ''static'' and the ancestor is one of the following HTML elements: td, th, or table.
* The element has a different [=effective zoom=] than ancestor.
1. If there is no more parent of ancestor in the flat tree, terminate this algorithm and return null.
1. Let ancestor be the parent of ancestor in the flat tree.
offsetParent_element_test.html
offsetParent-block-in-inline.html
offsetParent-fixed.html
The offsetTop attribute must return the result of running these steps:
1. If the element is the body element or does not have any associated [=CSS/box=] return zero and terminate this algorithm.
1. If the {{HTMLElement/offsetParent}} of the element is null return the [=unscaled=] y-coordinate of the top border edge of the first [=CSS/box=] associated with the element, relative to the initial containing block origin, ignoring any transformsthat apply to the element and its ancestors and terminate this algorithm.
1. Return the [=unscaled=] result of subtracting the y-coordinate of the top padding edge
of the first [=CSS/box=] associated with the {{HTMLElement/offsetParent}} of the element
from the y-coordinate of the top border edge
of the first [=CSS/box=] associated with the element,
relative to the initial containing block origin,
ignoring any transforms that apply to the element and its ancestors.
Note: An inline element that consists of multiple line boxes will only have its first [=CSS/box=] considered.
offsetTop-offsetLeft-nested-offsetParents.html
offsetTop-offsetLeft-with-zoom.html
offsetTopLeft-border-box.html
offsetTopLeft-empty-inline-offset.html
offsetTopLeft-empty-inline.html
offsetTopLeft-inline.html
offsetTopLeft-leading-space-inline.html
offsetTopLeft-table-caption.html
offsetTopLeft-trailing-space-inline.html
offsetTopLeftInScrollableParent.html
table-offset-props.html
The offsetLeft attribute must return the result of running these steps:
1. If the element is the body element or does not have any associated [=CSS/box=] return zero and terminate this algorithm.
1. If the {{HTMLElement/offsetParent}} of the element is null return the [=unscaled=] x-coordinate of the left border edge of the first [=CSS/box=] associated with the element, relative to the initial containing block origin, ignoring any transforms that apply to the element and its ancestors, and terminate this algorithm.
1. Return the [=unscaled=] result of subtracting the x-coordinate of the left padding edge of the first [=CSS/box=] associated with the {{HTMLElement/offsetParent}} of the element from the x-coordinate of the left border edge of the first [=CSS/box=] associated with the element, relative to the initial containing block origin, ignoring any transforms that apply to the element and its ancestors.
The offsetWidth attribute must return the result of running these steps:
1. If the element does not have any associated [=CSS/box=] return zero and terminate this algorithm.
1. Return the [=unscaled=] width of the axis-aligned bounding box
of the [=border boxes=]
of all fragments generated by the element's [=principal box=],
ignoring any transforms that apply to the element and its ancestors.
If the element's [=principal box=] is an [=inline-level box=]
which was "split" by a [=block-level=] descendant,
also include fragments generated by the [=block-level=] descendants,
unless they are zero width or height.
htmlelement-offset-width-001.html
The offsetHeight attribute must return the result of running these steps:
1. If the element does not have any associated [=CSS/box=] return zero and terminate this algorithm.
1. Return the [=unscaled=] height of the axis-aligned bounding box
of the [=border boxes=]
of all fragments generated by the element's [=principal box=],
ignoring any transforms that apply to the element and its ancestors.
If the element's [=principal box=] is an [=inline-level box=]
which was "split" by a [=block-level=] descendant,
also include fragments generated by the [=block-level=] descendants,
unless they are zero width or height.
Extensions to the {{HTMLImageElement}} Interface
partial interface HTMLImageElement {
readonly attribute long x;
readonly attribute long y;
};
The x attribute, on getting, must return the [=scaled=] x-coordinate of the left border edge of the
first [=CSS/box=] associated with the element, relative to the initial containing block origin, ignoring any
transforms that apply to the element and its ancestors, or zero if there is no [=CSS/box=].
The y attribute, on getting, must return the [=scaled=] y-coordinate of the top border edge of the
first [=CSS/box=] associated with the element, relative to the initial containing block origin, ignoring any
transforms that apply to the element and its ancestors, or zero if there is no [=CSS/box=].
cssom-view-img-attributes-001.html
image-x-y-zoom.html
HTMLImageElement-x-and-y-ignore-transforms.html
Extensions to the {{Range}} Interface
partial interface Range {
DOMRectList getClientRects();
[NewObject] DOMRect getBoundingClientRect();
};
The getClientRects() method, when invoked, must return an empty
{{DOMRectList}} object if the range is not in the document and otherwise a {{DOMRectList}} object
containing a list of {{DOMRect}} objects in content order that matches the following constraints:
* For each element selected by the range, whose parent is not selected by the range, include the border areas returned by invoking {{Element/getClientRects()}} on the element.
* For each {{Text}} node selected or partially selected by the range (including when the
boundary-points are identical), include [=scaled=] {{DOMRect}} object (for the part that is selected, not
the whole line box). The bounds of these {{DOMRect}} objects are computed using font metrics;
thus, for horizontal writing, the vertical dimension of each box is determined by the font
ascent and descent, and the horizontal dimension by the text advance width. If the range covers
a partial typographic character unit (e.g. half a surrogate pair or part of
a grapheme cluster), the full typographic character unit must be included
for the purpose of computing the bounds of the relevant {{DOMRect}}. [[!CSS-TEXT-3]] The
transforms that apply to the ancestors are applied.
Note: The {{DOMRect}} objects returned by {{Range/getClientRects()}} are not live.
range-bounding-client-rect-with-nested-text.html
range-client-rects-surrogate-indexing.html
The getBoundingClientRect() method, when invoked, must return the result of the following
algorithm:
1. Let list be the result of invoking {{Range/getClientRects()}} on the same range this method was invoked on.
1. If list is empty return a {{DOMRect}} object whose {{DOMRect/x}}, {{DOMRect/y}}, {{DOMRect/width}} and {{DOMRect/height}} members are zero.
1. If all rectangles in list have zero width or height, return the first rectangle in
list.
1. Otherwise, return a {{DOMRect}} object describing the smallest rectangle that includes all
of the rectangles in list of which the height or width is not zero.
Note: The {{DOMRect}} object returned by {{Range/getBoundingClientRect()}} is not live.
range-bounding-client-rect-with-display-contents.html
Extensions to the {{MouseEvent}} Interface
Issue: The object IDL fragment redefines some members. Can we resolve this somehow?
mouseEvent.html
The screenX attribute must return the x-coordinate of
the position where the event occurred relative to the origin of the
Web-exposed screen area.
The screenY attribute must return the y-coordinate of
the position where the event occurred relative to the origin of the
Web-exposed screen area.
The pageX attribute must follow these steps:
1. If the event's dispatch flag is set, return the horizontal coordinate of the position where the event occurred relative to the origin of the initial containing block and terminate these steps.
1. Let offset be the value of the {{Window/scrollX}} attribute of the event's associated {{Window}} object, if there is one, or zero otherwise.
1. Return the sum of offset and the value of the event's {{MouseEvent/clientX}} attribute.
The pageY attribute must follow these steps:
1. If the event's dispatch flag is set, return the vertical coordinate of the position where the event occurred relative to the origin of the initial containing block and terminate these steps.
1. Let offset be the value of the {{Window/scrollY}} attribute of the event's associated {{Window}} object, if there is one, or zero otherwise.
1. Return the sum of offset and the value of the event's {{MouseEvent/clientY}} attribute.
The clientX attribute must return the x-coordinate of
the position where the event occurred relative to the origin of the
viewport.
The clientY attribute must return the y-coordinate of
the position where the event occurred relative to the origin of the
viewport.
The x attribute must return the value of {{MouseEvent/clientX}}.
The y attribute must return the value of {{MouseEvent/clientY}}.
The offsetX attribute must follow these steps:
1. If the event's dispatch flag is set, return the x-coordinate of the position where the event occurred relative to the origin of the padding edge of the target node, ignoring the transforms that apply to the element and its ancestors, and terminate these steps.
1. Return the value of the event's {{MouseEvent/pageX}} attribute.
mouseEvent-offsetXY-svg.html
The offsetY attribute must follow these steps:
1. If the event's dispatch flag is set, return the y-coordinate of the position where the event occurred relative to the origin of the padding edge of the target node, ignoring the transforms that apply to the element and its ancestors, and terminate these steps.
1. Return the value of the event's {{MouseEvent/pageY}} attribute.
Geometry
The {{GeometryUtils}} Interface
enum CSSBoxType { "margin", "border", "padding", "content" };
dictionary BoxQuadOptions {
CSSBoxType box = "border";
GeometryNode relativeTo; // XXX default document (i.e. viewport)
};
dictionary ConvertCoordinateOptions {
CSSBoxType fromBox = "border";
CSSBoxType toBox = "border";
};
interface mixin GeometryUtils {
sequence<DOMQuad> getBoxQuads(optional BoxQuadOptions options = {});
DOMQuad convertQuadFromNode(DOMQuadInit quad, GeometryNode from, optional ConvertCoordinateOptions options = {});
DOMQuad convertRectFromNode(DOMRectReadOnly rect, GeometryNode from, optional ConvertCoordinateOptions options = {});
DOMPoint convertPointFromNode(DOMPointInit point, GeometryNode from, optional ConvertCoordinateOptions options = {}); // XXX z,w turns into 0
};
Text includes GeometryUtils; // like Range
Element includes GeometryUtils;
CSSPseudoElement includes GeometryUtils;
Document includes GeometryUtils;
typedef (Text or Element or CSSPseudoElement or Document) GeometryNode;
The getBoxQuads(options) method must run the following steps:
DOM order
p1 = top left even in RTL
scale to 0 means divide by zero, return 0x0
cross-frames not allowed, throw WrongDocumentError?
points are flattened (3d transform), z=0. like getClientRect
test block in inline
pseudo-elements before/after are children of the element
viewport boxes are all the same
cssom-getBoxQuads-001.html
cssom-getBoxQuads-002.html
The convertQuadFromNode(quad, from, options) method
must run the following steps:
...
The convertRectFromNode(rect, from, options) method
must run the following steps:
...
The convertPointFromNode(point, from, options)
method must run the following steps:
This section integrates with the event loop defined in HTML. [[!HTML]]
When asked to run the resize steps for a {{Document}} doc, run these steps:
1. If doc's viewport has had its width or height changed
(e.g. as a result of the user resizing the browser window,
or changing page zoom,
or an iframe element's dimensions are changed)
since the last time these steps were run,
fire an event named resize
at the {{Window}} object associated with doc.
1. If the {{VisualViewport}} associated with doc has had its scale,
width, or height properties changed since
the last time these steps were run, fire an event named resize at the {{VisualViewport}}.
resize-event-on-initial-layout-001.html
resize-event-on-initial-layout-002.html
Fired at the {{VisualViewport}}, {{Document}} or element when the {{VisualViewport}}, viewport, or element is scrolled, respectively.
scrollend
{{Event}}
{{Document}}, elements, {{VisualViewport}}
Fired at the {{VisualViewport}}, {{Document}}, or element when a scroll is completed: the
{{VisualViewport}}, viewport, or element has been scrolled, the scroll sequence has ended and any scroll offset changes have
been applied.
Post-Layout State Snapshotting {#post-layout-snapshot}
======================================================
Some CSS features use post-layout state, like scroll position, as input to the next style and layout update.
When asked to run snapshot post-layout state steps for a {{Document}} doc, run these steps:
1. For each CSS feature that needs to snapshot post-layout state, take a snapshot of the relevant state in doc.
The state that is snapshot is defined in other specifications. These steps must not invalidate doc or any other {{Document}}s in such a way that other post-layout snapshotting steps can observe that such snapshotting happened. It follows that the order of which such snapshotting takes place must not matter.
Privacy Considerations {#privacy}
===============================================
The {{Screen}} interface exposes information about the user's display configuration, which maybe be used as input to fingerprinting algorithms. User agents may choose to hide or quantize information about the screen size or configuration, in order to protect the user’s privacy.
{{MouseEvent}} contains information about the screen-relative coordinates of the event. User agents may set these properties to values that obscure the actual screen-relative location of the event, in order to protect the user’s privacy.
Security Considerations {#security}
===================================
No new security considerations have been reported on this specification.
Changes {#changes}
==================================================
This section documents some of the changes between publications of this specification. This section is not exhaustive. Bug fixes and editorial changes are
generally not listed.
* Added Simon Fraser and Emilio Cobos Álvarez as current editors and moved Simon Pieters to former editors.
* Clarified how {{Range/getClientRects()}} handles typographic character units.
* Changed how {{Element/getBoundingClientRect()}} of {{Element}} and {{Range/getBoundingClientRect()}} of {{Range}} handle empty rectangles.
* Changed definition of {{HTMLElement/offsetParent}} for Shadow DOM.
* Allowed UAs to lie about {{Screen}} properties for privacy reasons.
* Changed {{Screen/colorDepth}} and {{Screen/pixelDepth}} to return real values.
* Changed 'CSS pixels' to refer to [[!CSS-VALUES]].
* Changed default values for {{ScrollIntoViewOptions}} to start and nearest and slightly changed behavior of {{Element/scrollIntoView()}}
* Added {{Window/screenLeft}} and {{Window/screenTop}} as aliases for {{Window/screenX}} and {{Window/screenY}}.
* Defined overflow directions in terms of block-end and inline-end.
* Renamed the arguments to {{Window/resizeTo()}} to be width and height
* Added script-triggered scroll-snap to list of scrolls affected by 'scroll-behavior'.
* Fixed a logical error in the Terminology section.
* Added the "Security Considerations" and "Privacy Considerations" sections
* Moved the 'scroll-behavior' property to [[CSS-OVERFLOW-3]]
* Adjusted the algorithm for {{HTMLElement/offsetWidth}} and {{HTMLElement/offsetHeight}}.
* Added {{Element/checkVisibility()}} method to {{Element}}.
* Moved the scrollend event from WICG overscroll-scrollend-events to [[CSSOM-VIEW-1]] and added details for handling them.
* Added a "get the bounding box" algorithm to {{Element/getBoundingClientRect()}}.
* Introduced the {{VisualViewport}} API and related concepts.
* Extended scroll into view algorithm to also work on {{Range|Ranges}}.
* Clarified whether scaled or unscaled dimensions are returned by various APIs in relation to the 'zoom' property.
* Took scroll snapping and scroll target into account for various scrolling APIs.
* Added {{Element/currentCSSZoom}} attribute to {{Element}}.
* Added options parameter to {{Document/caretPositionFromPoint()}} method.
* Removed caret range concept from CaretPosition interface.
* Defined post-layout snapshotting.
* Made the various scrolling algorithms accept a pseudo-element.
* Added ''container'' option to {{ScrollIntoViewOptions}}.
* Added the {{HTMLElement/scrollParent}} attribute.
* Pinch zoom got renamed to scale factor.
* The {{Element/scrollIntoView()}} method on {{Element}} was changed and extended.
* The {{Element/scrollTop}} and {{Element/scrollLeft}} IDL attributes on {{Element}} changed to no
longer take an object; the {{Element/scroll()}}, {{Element/scrollTo()}} and
{{Element/scrollBy()}} methods were added instead.
* The {{Element/scrollWidth}}, {{Element/scrollHeight}}, {{Element/clientTop}},
{{Element/clientLeft}}, {{Element/clientWidth}} and {{Element/clientHeight}} IDL attributes on
{{Element}} were changed back to return integers.
* The DOMRectList interface was removed.
* The {{Document/scrollingElement}} IDL attribute on {{Document}} was added.
* Some readonly attributes on {{Window}} were annotated with [Replaceable] IDL extended
attribute.
* {{MediaQueryList}}, scroll event and resize event are integrated with
the event loop in HTML so they are synchronized with animation frames.
* The instant value of 'scroll-behavior' was renamed to ''scroll-behavior/auto''.
* The origin of {{Element/scrollLeft}} on {{Element}} was changed (for RTL).
* The {{Element/scrollIntoView()}} method on {{Element}} and {{Window/scroll()}},
{{Window/scrollTo()}} and {{Window/scrollBy()}} methods on {{Window}} take the relevant
dictionary as the first argument.
* The {{MediaQueryList}} interface was changed to use regular event API and define
{{MediaQueryList/addListener()}} in terms of that.
* Added "Change History" section.
* Moved Glenn Adams to former editors.
* Added Simon Pieters and Glenn Adams as editors and moved Anne van Kesteren to former editors.
* Introduced 'scroll-behavior' CSS property.
* Added Block flow direction and inline base direction from [[CSS-WRITING-MODES-3]] to terminology.
* Added section about zooming.
* Added {{Window/moveTo()}}, {{Window/moveBy()}}, {{Window/resizeTo()}}, and {{Window/resizeBy()}} methods to {{Window}}.
* Added {{Window/devicePixelRatio}} attribute to {{Window}}.
* Introduced {{ScrollOptions}} dictionary and added an 'options' parameter to scrolling methods.
* Added {{Window/devicePixelRatio}} attribute to {{Window}}.
* Added ''features'' parameter to {{Window/open()}} method.
* Added {{Document/elementsFromPoint()}} method to {{Document}}.
* Added {{CaretPosition/getClientRect()}} method to {{CaretPosition}}.
* Introduced initial draft of {{GeometryUtils}} interface.
* Changed {{Window/innerWidth}}, {{Window/innerHeight}}, etc. to use ''double''.
* CSS transforms are now acknowledged.
* Replaced ClientRect by {{DOMRect}}.
* Defined the firing behavior of scroll and resize events.
* Changed {{Screen/colorDepth}} and {{Screen/pixelDepth}} to always return 24.
* Removed redundant definition of terminology of other specifications, explicitly defining units (e.g. CSS pixels) and content/document content distinction.
* Introduced {{MediaQueryList}} interface.
* Moved the matchMedium() method of the Media to the {{Window}} interface, renamed it to {{Window/matchMedia()}}, and changed its return type to {{MediaQueryList}}.
* Removed the AbstractView and Media interfaces.
* Removed the DocumentView interface and moved methods {{Document/elementFromPoint()}} and caretRangeFromPoint() to the {{Document}} interface.
* Renamed the caretRangeFromPoint() method to {{Document/caretPositionFromPoint()}}.
* Introduced {{CaretPosition}} interface and changed the return type of {{Document/caretPositionFromPoint()}} to ''CaretPosition''.
* Added the {{Element/scrollIntoView()}} method to the {{Element}} interface.
* Removed the WindowView interface and moved its attributes and methods to an AbstractView and inheriting ScreenView interface.
* Added the document IDL attribute to AbstractView.
* Added the {{Window/scroll()}}, {{Window/scrollTo()}}, and {{Window/scrollBy()}} methods to the ScreenView interface.
* Removed the ElementView interface and moved its attributes and methods to the {{Element}} and {{HTMLElement}} interfaces.
* Added the {{Document/defaultView}} IDL attribute and caretRangeFromPoint() method to the DocumentView interface.
* Removed RangeView interface and instead directly extended the {{Range}} interface.
* Removed the MouseEventView interface and instead directly extended the {{MouseEvent}} interface.
* Renamed the TextRectangleList interface to ClientRectList and turned the item() method into an indexed getter.
* Renamed the TextRectangle interface to ClientRect and added the width and height attributes.
Acknowledgements {#acks}
==================================================
The editors would like to thank
Alan Stearns,
Alexey Feldgendler,
Antonio Gomes,
Björn Höhrmann,
Boris Zbarsky,
Chris Rebert,
Corey Farwell,
Dan Bates,
David Vest,
Elliott Sprehn,
Garrett Smith,
Henrik Andersson,
Hallvord R. M. Steen,
Kang-Hao Lu,
Koji Ishii,
Leif Arne Storset,
Luiz Agostini,
Maciej Stachowiak,
Michael Dyck,
Mike Wilson,
Morten Stenshorne,
Olli Pettay,
Pavel Curtis,
Peter-Paul Koch,
Rachel Kmetz,
Rick Byers,
Robert O'Callahan,
Sam Weinig,
Scott Johnson,
Sebastian Zartner,
Stewart Brodie,
Sylvain Galineau,
Tab Atkins,
Tarquin Wilton-Jones,
Thomas Moore,
Thomas Shinnick,
and
Xiaomei Ji
for their contributions to this document.
Special thanks to the Microsoft employees who first implemented many of
the features specified in this draft, which were first widely deployed by
the Windows Internet Explorer browser.
client-props-root-display-none-crash.html
overflow-hidden-smooth-scroll-crash.html
inheritance.html
parsing/scroll-behavior-computed.html
parsing/scroll-behavior-invalid.html
parsing/scroll-behavior-valid.html
position-sticky-root-scroller-with-scroll-behavior.html
scroll-back-to-initial-position.html
scroll-behavior-default-css.html
scroll-behavior-element.html
scroll-behavior-main-frame-root.html
scroll-behavior-main-frame-window.html
scroll-behavior-scrollintoview-nested.html
scroll-behavior-smooth-navigation.html
scroll-behavior-smooth-positions.html
scroll-behavior-smooth.html
scroll-behavior-subframe-root.html
scroll-behavior-subframe-window.html