10BC0 csswg-drafts/cssom-view/Overview.src.html at 064c8e84d0cfaa12e7ca59207bd4ad06875760e6 · w3c/csswg-drafts · GitHub
Skip to content

Latest commit

 

History

History
1699 lines (1424 loc) · 94.2 KB

File metadata and controls

1699 lines (1424 loc) · 94.2 KB
<!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 rel=stylesheet href=../default.css>
<link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/W3C-[STATUS]">
</head>
<body class="draft">
<div class="head">
<!--logo-->
<h1>CSSOM View Module</h1>
<h2 class="no-num no-toc" id="w3c-doctype">[LONGSTATUS] [DATE: 3 August 2002]</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>
<dd class=publish><a href="[VERSION]">[VERSION]</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&amp;component=CSSOM%20View">File a bug</a>
(<a href="https://www.w3.org/Bugs/Public/buglist.cgi?component=CSSOM%20View&amp;product=CSS&amp;resolution=---">open bugs</a>)
<script async="" src="https://w3c-test.org/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 class=publish>Latest Version:</dt>
<dd class=publish><a href="[LATEST]">[LATEST]</a></dd>
<dt class=publish>Latest Editor Draft:</dt>
<dd class=publish><a href="http://dev.w3.org/csswg/cssom-view/">http://dev.w3.org/csswg/cssom-view/</a></dd>
<dt class=dontpublish>Previous Versions:</dt>
<dd class=dontpublish><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 class=dontpublish><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 class=dontpublish><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>)
&lt;<a href="mailto:simponp@opera.com">simonp@opera.com</a>&gt;</dd>
<dd><a href="http://www.w3.org/wiki/User:Gadams">Glenn Adams</a>
(<a href="http://www.cox.com/">Cox Communications, Inc.</a>)
&lt;<a href="mailto:glenn.adams@cox.com">glenn.adams@cox.com</a>&gt;</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>)
&lt;<a href="mailto:annevk@annevk.nl">annevk@annevk.nl</a>&gt;</dd>
</dl>
<!--copyright-->
</div>
<hr>
<h2 class="no-num no-toc">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 id="sotd" class="no-num no-toc">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 [DATE: 3 August 2002] [LONGSTATUS] 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 id="toc" class="no-num no-toc">Table of Contents</h2>
<!-- toc -->
<h2>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>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. <span
data-anolis-ref>RFC2119</span>
<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 <span data-anolis-spec=dom>case-sensitive</span> manner.
<p>A conforming user agent implements all the requirements made by this
specification.</p>
<h3>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. <span data-anolis-ref>WEBIDL</span>
<h2>Terminology</h2>
<p>Terminology used in this specification is from
DOM,
CSSOM and
HTML.
<span data-anolis-ref>DOM</span>
<span data-anolis-ref>CSSOM</span>
<span data-anolis-ref>HTML</span>
<p class="issue"><dfn><code>MouseEvent</code></dfn> and <dfn><code>MouseEventInit</code></dfn> are defined in &hellip;
<p><dfn>The HTML <code title>body</code> element</dfn> is the first
<code title>body</code>
<span data-anolis-spec=html title="HTML elements">HTML element</span> child of the root
<span data-anolis-spec=html title="HTML elements">HTML element</span> <code title>html</code>.</p>
<p><dfn>Content edge</dfn>,
<dfn>padding edge</dfn>,
<dfn>border edge</dfn>,
<dfn>margin edge</dfn> and
<dfn>canvas</dfn> are defined by CSS.
<!--<span data-anolis-ref>CSS</span>-->
<p><dfn>Viewport</dfn> and
<dfn>initial containing block</dfn> are
defined by CSS 2.1 unless there is an ancestor <code title>foreignObject</code>
element in the <code title>http://www.w3.org/2000/svg</code> namespace that has an associated <span>SVG layout box</span> in which
case that element acts as viewport and initial containing block.
<!--<span data-anolis-ref>CSS</span>-->
<p><dfn>Block flow direction</dfn> and <dfn>inline base direction</dfn> are defined in CSS Writing Modes Module. <span data-anolis-ref>CSSWRITINGMODES</span>
<p>A scrolling box of a <span>viewport</span> or element has two <dfn>overflow directions</dfn>, depending on the <span>viewport</span>'s or element's
<span>block flow direction</span> and <span>inline base direction</span>, as follows:
<dl class=switch>
<dt>If the <span>block flow direction</span> is top-to-bottom and the <span>inline base direction</span> is left-to-right
<dt>If the <span>block flow direction</span> is left-to-right and the <span>inline base direction</span> is left-to-right
<dd><p>Rightward and downward.
<dt>If the <span>block flow direction</span> is top-to-bottom and the <span>inline base direction</span> is right-to-left
<dt>If the <span>block flow direction</span> is right-to-left and the <span>inline base direction</span> is left-to-right
<dd><p>Leftward and downward.
<dt>If the <span>block flow direction</span> is right-to-left and the <span>inline base direction</span> is right-to-left
<dd><p>Leftward and upward.
<dt>If the <span>block flow direction</span> is left-to-right and the <span>inline base direction</span> is right-to-left
<dd><p>Righward and upward.
</dl>
<p>The term <dfn>scrolling area</dfn> refers to a box of a <span>viewport</span> or an element that has the following edges, depending on the
<span>viewport</span>'s or element's scrolling box's <span>overflow directions</span>.
<table class="complex data">
<thead>
<tr>
<th>If the <span>overflow directions</span> are&hellip;
<th>For a <span>viewport</span>
<th>For an element
<tbody>
<tr>
<td>rightward and downward
<td class=long>
<dl>
<dt>top edge
<dd><p>The top edge of the <span>initial containing block</span>.
<dt>right edge
<dd><p>The right-most edge of the right edge of the <span>initial containing block</span> and the right <span>margin edge</span> of the
<span>viewport</span>'s all descendant boxes.
<dt>bottom edge
<dd><p>The bottom-most edge of the bottom edge of the <span>initial containing block</span> and the bottom <span>margin edge</span> of the
<span>viewport</span>'s all descendant boxes.
<dt>left edge
<dd><p>The left edge of the <span>initial containing block</span>.
</dl>
<td class=long>
<dl>
<dt>top edge
<dd><p>The element's top <span>padding edge</span>.
<dt>right edge
<dd><p>The right-most edge of the element's right <span>padding edge</span> and the right <span>margin edge</span> 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 <span>padding edge</span> and the bottom <span>margin edge</span> 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 <span>padding edge</span>.
</dl>
<tr>
<td>leftward and downward
<td class=long>
<dl>
<dt>top edge
<dd><p>The top edge of the <span>initial containing block</span>.
<dt>right edge
<dd><p>The right edge of the <span>initial containing block</span>.
<dt>bottom edge
<dd><p>The bottom-most edge of the bottom edge of the <span>initial containing block</span> and the bottom <span>margin edge</span> of the
<span>viewport</span>'s all descendant boxes.
<dt>left edge
<dd><p>The left-most edge of the left edge of the <span>initial containing block</span> and the left <span>margin edge</span> of the
<span>viewport</span>'s all descendant boxes.
</dl>
<td class=long>
<dl>
<dt>top edge
<dd><p>The element's top <span>padding edge</span>.
<dt>right edge
<dd><p>The element's right <span>padding edge</span>.
<dt>bottom edge
<dd><p>The bottom-most edge of the element's bottom <span>padding edge</span> and the bottom <span>margin edge</span> 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 <span>padding edge</span> and the left <span>margin edge</span> 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 <span>initial containing block</span> and the top <span>margin edge</span> of the
<span>viewport</span>'s all descendant boxes.
<dt>right edge
<dd><p>The right edge of the <span>initial containing block</span>.
<dt>bottom edge
<dd><p>The bottom edge of the <span>initial containing block</span>.
<dt>left edge
<dd><p>The left-most edge of the left edge of the <span>initial containing block</span> and the left <span>margin edge</span> of the
<span>viewport</span>'s all descendant boxes.
</dl>
<td class=long>
<dl>
<dt>top edge
<dd><p>The top-most edge of the element's top <span>padding edge</span> and the top <span>margin edge</span> 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 <span>padding edge</span>.
<dt>bottom edge
<dd><p>The element's bottom <span>padding edge</span>.
<dt>left edge
<dd><p>The left-most edge of the element's left <span>padding edge</span> and the left <span>margin edge</span> 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 <span>initial containing block</span> and the top <span>margin edge</span> of the
<span>viewport</span>'s all descendant boxes.
<dt>right edge
<dd><p>The right-most edge of the right edge of the <span>initial containing block</span> and the right <span>margin edge</span> of the
<span>viewport</span>'s all descendant boxes.
<dt>bottom edge
<dd><p>The bottom edge of the <span>initial containing block</span>.
<dt>left edge
<dd><p>The left edge of the <span>initial containing block</span>.
</dl>
<td class=long>
<dl>
<dt>top edge
<dd><p>The top-most edge of the element's top <span>padding edge</span> and the top <span>margin edge</span> 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 <span>padding edge</span> and the right <span>margin edge</span> 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 <span>padding edge</span>.
<dt>left edge
<dd><p>The element's left <span>padding edge</span>.
</dl>
</table>
<p>The <dfn>beginning edges</dfn> of a particular set of edges of a box or element are the following edges:
<dl class=switch>
<dt>If the <span>overflow directions</span> are rightward and downward
<dd><p>The top and left edges.
<dt>If the <span>overflow directions</span> are leftward and downward
<dd><p>The top and right edges.
<dt>If the <span>overflow directions</span> are leftward and upward
<dd><p>The bottom and right edges.
<dt>If the <span>overflow directions</span> are rightward and upward
<dd><p>The bottom and left edges.
</dl>
<p>The <dfn>ending edges</dfn> of a particular set of edges of a box or element are the following edges:
<dl class=switch>
<dt>If the <span>overflow directions</span> are rightward and downward
<dd><p>The bottom and right edges.
<dt>If the <span>overflow directions</span> are leftward and downward
<dd><p>The bottom and left edges.
<dt>If the <span>overflow directions</span> are leftward and upward
<dd><p>The top and left edges.
<dt>If the <span>overflow directions</span> are rightward and upward
<dd><p>The top and right edges.
</dl>
<p>The term <dfn>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 <span>CSS
layout box</span> (the column or column group, respectively).</p>
<p>The term <dfn>SVG layout box</dfn> refers to the same term in SVG.
<p class=issue>The terms <span>CSS layout box</span> and <span>SVG layout box</span> are not currently defined by CSS or SVG.
<p>The term <dfn>layout box</dfn> refers to either a <span>CSS layout box</span> or an <span>SVG layout box</span>.
<h3>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>matchMedia()</code> as the units
are explicitly given there.</p>
<h2>Common Infrastructure</h2>
<h3>Scrolling</h3>
<p>When a user agent is to <dfn>perform a scroll</dfn> of a scrolling box <var>box</var>, to a given position <var>position</var>, with a set of
steps <var>task</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><span title=concept-smooth-scroll-aborted>Abort</span> any ongoing <span title=concept-smooth-scroll>smooth scroll</span> for <var>box</var>.
<li><p>If the user agent honors the '<span>scroll-behavior</span>' 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
'<span>scroll-behavior</span>' property is '<span title=scroll-behavior-smooth>smooth</span>'
<li><p><var>behavior</var> is <code title>smooth</code>
</ul>
<p>...then follow these substeps:
<ol>
<li><p>Perform a <span title=concept-smooth-scroll>smooth scroll</span> of <var>box</var> to <var>position</var>.
<li><p><span data-anolis-spec=html>Queue a task</span> to run <var>task</var>, unless a <span data-anolis-spec=html title=concept-task>task</span> to
run <var>task</var> is in the <span data-anolis-spec=html title="queue a task">queue</span>.
<li><p>Repeat the previous step in a user-agent-defined interval while the <span title=concept-smooth-scroll>smooth scroll</span> is ongoing, as well as when
the <span title=concept-smooth-scroll>smooth scroll</span> is <span title=concept-smooth-scroll-completed>completed</span> (but not if it is
<span title=concept-smooth-scroll-aborted>aborted</span>). <!--fingerprint-->
</ol>
<li><p>Otherwise, follow these substeps:
<ol>
<li><p>Perform an <span title=concept-instant-scroll>instant scroll</span> of <var>box</var> to <var>position</var>.
<li><p><span data-anolis-spec=html>Queue a task</span> to run <var>task</var>, unless a <span data-anolis-spec=html title=concept-task>task</span> to
run <var>task</var> is in the <span data-anolis-spec=html title="queue a task">queue</span>.
</ol>
</ol>
<p>When a user agent is to perform a <dfn title=concept-smooth-scroll>smooth scroll</dfn> of a scrolling box <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 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 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 title=concept-instant-scroll>instant scroll</dfn> of a scrolling box <var>box</var> to
<var>position</var>, it must update the scroll position of <var>box</var> to <var>position</var>.
<p>To <dfn>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 <span>viewport</span> 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 <span>beginning edges</span> of the
<span>scrolling area</span> with the <span>beginning edges</span> 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
<span title=concept-smooth-scroll>smooth scroll</span>, abort these steps.
<li><p>Let <var>task</var> be these steps:
<ol>
<li><p><span data-anolis-spec=dom title=concept-event-fire>Fire an event</span> named <code title>scroll</code> that bubbles at <var>document</var>.
</ol>
<li><p><span>Perform a scroll</span> of <var>viewport</var> to <var>position</var>, with the set of steps <var>task</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. <span data-anolis-ref>HTML</span>
<h2>Extensions to the <code title>Window</code> Interface</h2>
<pre class=idl>enum <dfn>ScrollBehavior</dfn> { "auto", "instant", "smooth" };
dictionary <dfn>ScrollOptions</dfn> {
<span>ScrollBehavior</span> behavior = "auto";
};
partial interface <span data-anolis-spec=html>Window</span> {
<span>MediaQueryList</span> <span title=dom-Window-matchMedia>matchMedia</span>(DOMString query);
[SameObject] readonly attribute <span>Screen</span> <span title=dom-Window-screen>screen</span>;
// browsing context
void <span title=dom-Window-moveTo>moveTo</span>(double x, double y);
void <span title=dom-Window-moveBy>moveBy</span>(double x, double y);
void <span title=dom-Window-resizeTo>resizeTo</span>(double x, double y);
void <span title=dom-Window-resizeBy>resizeBy</span>(double x, double y);
// viewport
readonly attribute double <span title=dom-Window-innerWidth>innerWidth</span>;
readonly attribute double <span title=dom-Window-innerHeight>innerHeight</span>;
// viewport scrolling
readonly attribute double <span title=dom-Window-scrollX>scrollX</span>;
readonly attribute double <span title=dom-Window-pageXOffset>pageXOffset</span>;
readonly attribute double <span title=dom-Window-scrollY>scrollY</span>;
readonly attribute double <span title=dom-Window-pageYOffset>pageYOffset</span>;
void <span title=dom-Window-scroll>scroll</span>(double x, double y, optional <span>ScrollOptions</span> options);
void <span title=dom-Window-scrollTo>scrollTo</span>(double x, double y, optional <span>ScrollOptions</span> options);
void <span title=dom-Window-scrollBy>scrollBy</span>(double x, double y, optional <span>ScrollOptions</span> options);
// client
readonly attribute double <span title=dom-Window-screenX>screenX</span>;
readonly attribute double <span title=dom-Window-screenY>screenY</span>;
readonly attribute double <span title=dom-Window-outerWidth>outerWidth</span>;
readonly attribute double <span title=dom-Window-outerHeight>outerHeight</span>;
};</pre>
<p>When the <dfn 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
<span title='parse a media query list' data-anolis-spec=cssom>parsing</span>
<var>query</var>.</p></li>
<li><p>Return a <em>new</em> <code>MediaQueryList</code> object,
associated with the <code data-anolis-spec=html>Window</code> object, with
<var>parsed media query list</var> as its associated
media query list.</p></li>
</ol>
<p>The <dfn title=dom-Window-screen><code>screen</code></dfn> attribute must return the <code>Screen</code> object
associated with the <code data-anolis-spec=html>Window</code> object.</p>
<p class='note'>Accessing <code title=dom-Window-screen>screen</code> through a <code data-anolis-spec=html>WindowProxy</code> object might yield different
results when the <code data-anolis-spec=dom>Document</code> is navigated.</p>
<p>The <dfn 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>Let <var>target</var> be the <span data-anolis-spec=html>browsing context</span> of the <span data-anolis-spec=dom>context
object</span>.
<li><p>Let <var>source</var> be the <span data-anolis-spec=html>browsing context</span> of the <span data-anolis-spec=html>incumbent script</span>.
<li><p>If <var>source</var> is not <span>allowed to resize and move</span> <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 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>Let <var>target</var> be the <span data-anolis-spec=html>browsing context</span> of the <span data-anolis-spec=dom>context
object</span>.
<li><p>Let <var>source</var> be the <span data-anolis-spec=html>browsing context</span> of the <span data-anolis-spec=html>incumbent script</span>.
<li><p>If <var>source</var> is not <span>allowed to resize and move</span> <var>target</var>, terminate these steps.
<li BC1C ><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 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>Let <var>target</var> be the <span data-anolis-spec=html>browsing context</span> of the <span data-anolis-spec=dom>context
object</span>.
<li><p>Let <var>source</var> be the <span data-anolis-spec=html>browsing context</span> of the <span data-anolis-spec=html>incumbent script</span>.
<li><p>If <var>source</var> is not <span>allowed to resize and move</span> <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 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 <span data-anolis-spec=html>browsing context</span> of the <span data-anolis-spec=dom>context
object</span>.
<li><p>Let <var>source</var> be the <span data-anolis-spec=html>browsing context</span> of the <span data-anolis-spec=html>incumbent script</span>.
<li><p>If <var>source</var> is not <span>allowed to resize and move</span> <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 <span data-anolis-spec=html>browsing context</span> <var>A</var> is <dfn>allowed to resize and move</dfn> a <span data-anolis-spec=html>browsing
context</span> <var>B</var> if all the following conditions are met:
<ul>
<li><p><var>B</var> is an <span data-anolis-spec=html>auxiliary browsing context</span> that was created by a script (as opposed to by an action of the user).
<li><p><var>A</var> is <span data-anolis-spec=html>familiar with</span> <var>B</var>.
</ul>
<p>The <dfn title=dom-Window-innerWidth><code>innerWidth</code></dfn> attribute must return the <span>viewport</span> width including the size of a rendered
scroll bar (if any), or zero if there is no <span>viewport</span>. <!--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 title=dom-Window-innerHeight><code>innerHeight</code></dfn> attribute must return the <span>viewport</span> height including the size of a rendered
scroll bar (if any), or zero if there is no <span>viewport</span>. <!--fingerprint--></p>
<p>The <dfn title=dom-Window-scrollX><code>scrollX</code></dfn> attribute attribute must return the x-coordinate, relative to the <span>initial containing
block</span> origin, of the left of the <span>viewport</span>, or zero if there is no <span>viewport</span>. <!--fingerprint--></p>
<p>The <dfn title=dom-Window-pageXOffset><code>pageXOffset</code></dfn> attribute must return the value returned by the
<code title=dom-Window-scrollX>scrollX</code> attribute.</p>
<p>The <dfn title=dom-Window-scrollY><code>scrollY</code></dfn> attribute attribute must return the y-coordinate, relative to the <span>initial containing
block</span> origin, of the top of the <span>viewport</span>, or zero if there is no <span>viewport</span>. <!--fingerprint--></p>
<p>The <dfn title=dom-Window-pageYOffset><code>pageYOffset</code></dfn> attribute must return the value returned by the
<code title=dom-Window-scrollY>scrollY</code> attribute.</p>
<p>When the <dfn title=dom-Window-scroll><code>scroll(<var>x</var>, <var>y</var>, <var>options</var>)</code></dfn> method is invoked these
steps must be run:</p>
<ol>
<li><p>If there is no <span>viewport</span>, abort these steps.
<li><p>Let <var>viewport width</var> be the width of the <span>viewport</span> excluding the width of the scroll bar, if any.
<li><p>Let <var>viewport height</var> be the height of the <span>viewport</span> excluding the height of the scroll bar, if any.
<li>
<dl class=switch>
<dt>If the <span>viewport</span> has rightward <span title="overflow directions">overflow direction</span>
<dd><p>Let <var>x</var> be max(0, min(<var>x</var>,
<span>viewport</span> <span>scrolling area</span> width - <var>viewport width</var>)).</p></dd>
<dt>If the <span>viewport</span> has leftward <span title="overflow directions">overflow direction</span>
<dd><p>Let <var>x</var> be min(0, max(<var>x</var>,
<var>viewport width</var> - <span>viewport</span> <span>scrolling area</span>
width)).</p></dd>
</dl>
<li>
<dl class=switch>
<dt>If the <span>viewport</span> has downward <span title="overflow directions">overflow direction</span>
<dd><p>Let <var>y</var> be max(0, min(<var>y</var>,
<span>viewport</span> <span>scrolling area</span> height - <var>viewport height</var>)).</p></dd>
<dt>If the <span>viewport</span> has upward <span title="overflow directions">overflow direction</span>
<dd><p>Let <var>y</var> be min(0, max(<var>y</var>,
<var>viewport height</var> - <span>viewport</span> <span>scrolling area</span>
height)).</p></dd>
</dl>
<li><p>Let <var>position</var> be the scroll position the <span>viewport</span> would have by aligning the x-coordinate <var>x</var> of the
<span>viewport</span> <span>scrolling area</span> with the left of the <span>viewport</span> and aligning the y-coordinate <var>y</var> of the
<span>viewport</span> <span>scrolling area</span> with the top of the <span>viewport</span>.
<li><p>If <var>position</var> is the same as the <span>viewport</span>'s current scroll position, and the <span>viewport</span> does not have an ongoing
<span title=concept-smooth-scroll>smooth scroll</span>, abort these steps.
<li><p>Let <var>task</var> be these steps:
<ol>
<li><p><span data-anolis-spec=dom title=concept-event-fire>Fire an event</span> named <code title>scroll</code> that bubbles at the
<code data-anolis-spec=dom>Document</code> object.
</ol>
<li><p><span>Perform a scroll</span> of the <span>viewport</span> to <var>position</var>, with the set of steps <var>task</var>, and the
<code data-anolis-spec=dom>Document</code>'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 title=dom-Window-scrollTo><code>scrollTo(<var>x</var>, <var>y</var>, <var>options</var>)</code></dfn> method is invoked, the
user agent must act as if the <code title=dom-Window-scroll>scroll()</code> method was invoked with the same arguments.</p>
<p>When the <dfn title=dom-Window-scrollBy><code>scrollBy(<var>x</var>, <var>y</var>, <var>options</var>)</code></dfn> method is invoked, the
user agent must act as if the <code title=dom-Window-scroll>scroll()</code> method was invoked with
<var>x</var> plus <code title='dom-Window-scrollX'>scrollX</code>
as first argument and <var>y</var> plus
<code title='dom-Window-scrollY'>scrollY</code> as second argument.</p>
<p>The <dfn 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 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 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 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>
<h4>The <var>features</var> argument to the <code title>open()</code> method</h4>
<p>HTML defines the <code data-anolis-spec=html title=dom-open>open()</code> method but has no defined effect for the third argument, <var>features</var>.
<span data-anolis-ref>HTML</span>
<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 <span data-anolis-spec=html>auxiliary browsing context</span> being created, terminate these steps.
<li><p>Let <var>target</var> be the new <span data-anolis-spec=html>auxiliary browsing context</span>.
<li><p>Let <var>tokens</var> be the result of <span data-anolis-spec=html title="split a string on commas">splitting <var>features</var> on commas</span>.
<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><span data-anolis-spec=html>Skip whitespace</span>.
<li><p><span data-anolis-spec=html>Collect a sequence of characters</span> that are not <span data-anolis-spec=html title="space character">space
characters</span> nor "<code title>=</code>" (U+003D). Let <var>name</var> be the collected characters, <span data-anolis-spec=dom>converted to ASCII
lowercase</span>.
<li><p>If <var>name</var> is in <var>parsed features</var> or if <var>name</var> is not a <span>supported <code title>open()</code> feature name</span>,
continue <i>token loop</i>.
<li><p><span data-anolis-spec=html>Skip whitespace</span>.
<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><span data-anolis-spec=html>Collect a sequence of characters</span> 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 <span data-anolis-spec=html>rules for parsing integers</span> 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>left</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>left</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>top</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>top</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>width</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>width</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>height</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>height</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>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>
</ol>
<p>A <dfn>supported <code title>open()</code> feature name</dfn> is one of the following:
<dl>
<dt><dfn title=dom-open-features-width>width</dfn>
<dd><p>The width of the viewport.
<dt><dfn title=dom-open-features-height>height</dfn>
<dd><p>The height of the viewport.
<dt><dfn title=dom-open-features-left>left</dfn>
<dd><p>The left position of the window.
<dt><dfn title=dom-open-features-top>top</dfn>
<dd><p>The top position of the window.
</dl>
<h3>The <code title>MediaQueryList</code> Interface</h3>
<p>A <code>MediaQueryList</code> object has an associated media query list set on creation and an associated
<dfn>list of media query list listeners</dfn>, which is initially empty.</p>
<p>If the associated media query list changes in evaluation then, for each
listener in the <span>list of media query list listeners</span> &mdash; in
appending order, <span data-anolis-spec=html>queue a task</span> that invokes the listener,
passing as argument the <code>MediaQueryList</code> object.</p>
<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(mql) {
if(mql.matches) // landscape
&hellip;
else
&hellip;
}
var mql = matchMedia("(orientation:landscape)")
mql.addListener(handleOrientationChange)</pre>
</div>
<pre class=idl>interface <dfn>MediaQueryList</dfn> {
readonly attribute DOMString <span title=dom-MediaQueryList-media>media</span>;
readonly attribute boolean <span title=dom-MediaQueryList-matches>matches</span>;
void <span title=dom-MediaQueryList-addListener>addListener</span>(<span>MediaQueryListListener</span> listener);
void <span title=dom-MediaQueryList-removeListener>removeListener</span>(<span>MediaQueryListListener</span> listener);
};
callback <dfn>MediaQueryListListener</dfn> = void (<span>MediaQueryList</span> list);</pre>
<p>The <dfn title=dom-MediaQueryList-media><code>media</code></dfn> attribute must return the
<span title='serialize a media query list' data-anolis-spec=cssom>serialized</span> form of the associated media query list.</p>
<p>The <dfn title=dom-MediaQueryList-matches><code>matches</code></dfn> attribute must return true if the associated media query list
matches the state of the rendered <code data-anolis-spec=dom>Document</code> and false if it does not. <!--fingerprint--></p>
<p>When the <dfn title=dom-MediaQueryList-addListener><code>addListener(<var>listener</var>)</code></dfn> method is invoked <var>listener</var> must
be appended to the <span>list of media query list listeners</span>, unless
it is already in the <span>list of media query list listeners</span>.</p>
<p>When the <dfn title=dom-MediaQueryList-removeListener><code>removeListener(<var>listener</var>)</code></dfn> method is invoked
<var>listener</var> must be removed from the <span>list of media query list listeners</span>.</p>
<h3>The <code title>Screen</code> Interface</h3>
<p>As its name suggests, the <code>Screen</code> interface represents information about the screen of the output device.</p>
<pre class=idl>interface <dfn>Screen</dfn> {
readonly attribute double <span title=dom-Screen-availWidth>availWidth</span>;
readonly attribute double <span title=dom-Screen-availHeight>availHeight</span>;
readonly attribute double <span title=dom-Screen-width>width</span>;
readonly attribute double <span title=dom-Screen-height>height</span>;
readonly attribute unsigned long <span title=dom-Screen-colorDepth>colorDepth</span>;
readonly attribute unsigned long <span title=dom-Screen-pixelDepth>pixelDepth</span>;
};</pre>
<p>The <dfn 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 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 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 title=dom-Screen-height><code>height</code></dfn> attribute must return the height of the output device, in CSS pixels. <!--fingerprint--></p>
<p>The <dfn title=dom-Screen-colorDepth><code>colorDepth</code></dfn> attribute must return 24.</p>
<p>The <dfn title=dom-Screen-pixelDepth><code>pixelDepth</code></dfn> attribute must return 24.</p>
<p class=note>The <code title=dom-Screen-colorDepth>colorDepth</code> and <code title=dom-Screen-pixelDepth>pixelDepth</code> attributes are useless but are
included for compatibility.
<h2>Extensions to the <code title>Document</code> Interface</h2>
<pre class=idl>partial interface <span data-anolis-spec=dom>Document</span> {
<span data-anolis-spec=dom>Element</span>? <span title=dom-Document-elementFromPoint>elementFromPoint</span>(double x, double y);
sequence&lt;<span data-anolis-spec=dom>Element</span>> <span title=dom-Document-elementsFromPoint>elementsFromPoint</span>(double x, double y);
<span>CaretPosition</span>? <span title=dom-Document-caretPositionFromPoint>caretPositionFromPoint</span>(double x, double y);
};</pre>
<p>The <dfn title=dom-Document-elementFromPoint><code>elementFromPoint(<var>x</var>, <var>y</var>)</code></dfn> method must follow these steps:
<ol>
<li><p>If either argument is negative, <var>x</var> is greater than the <span>viewport</span> width excluding the size of a rendered scroll bar (if any), or
<var>y</var> is greater than the <span>viewport</span> height excluding the size of a rendered scroll bar (if any), or there is no <span>viewport</span>
associated with the document, return null and terminate these steps.
<li><p>If there is a <span>layout box</span> in the <span>viewport</span> that would be a target for hit testing at coordinates <var>x</var>,<var>y</var>,
return the associated element and terminate these steps.
<li><p>If the document has a root element, return the root element and terminate these steps.
<li><p>Return null.
</ol>
<p class=note>The <code title=dom-Document-elementFromPoint>elementFromPoint()</code> 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.
<p class=atrisk>The <dfn title=dom-Document-elementsFromPoint><code>elementsFromPoint(<var>x</var>, <var>y</var>)</code></dfn> method must follow these steps:
<ol>
<li><p>Let <var>sequence</var> be a new empty sequence.
<li><p>If either argument is negative, <var>x</var> is greater than the <span>viewport</span> width excluding the size of a rendered scroll bar (if any), or
<var>y</var> is greater than the <span>viewport</span> height excluding the size of a rendered scroll bar (if any), or there is no <span>viewport</span>
associated with the document, return <var>sequence</var> and terminate these steps.
<li><p>For each <span>layout box</span> in the <span>viewport</span>, in paint order, starting with the topmost box, that would be a target for hit testing at
coordinates <var>x</var>,<var>y</var> even if nothing would be overlapping it, append the associated element to <var>sequence</var>.
<li><p>If the document has a root element, and the last item in <var>sequence</var> is not the root element, append the root element to <var>sequence</var>.
<li><p>Return <var>sequence</var>.
</ol>
<p>The <dfn title=dom-Document-caretPositionFromPoint><code>caretPositionFromPoint(<var>x</var>, <var>y</var>)</code></dfn> method must return the
result of running these steps:</p>
<ol>
<li><p>If there is no <span>viewport</span> associated with the document, return null.
<li><p>If either a 3BF6 rgument is negative, <var>x</var> is greater
than the <span>viewport</span> width excluding the size of a rendered
scroll bar (if any), <var>y</var> is greather than the
<span>viewport</span> height excluding the size of a rendered scroll bar
(if any) return null.</p></li>
<li><p>If at the coordinates <var>x</var>,<var>y</var>
in the <span>viewport</span> no text insertion point indicator would have
been inserted return null.</p></li>
<li>
<p>If at the coordinates <var>x</var>,<var>y</var>
in the <span>viewport</span> a text insertion point indicator would have
been inserted in a text entry widget which is also a replaced element
return a <span>caret position</span> with its properties set as
follows:</p>
<dl>
<dt><span>caret node</span></dt>
<dd><p>The node corresponding to the text entry widget.</p></dd>
<dt><span>caret offset</span></dt>
<dd><p>The amount of 16-bit units to the left of where the
text insertion point indicator would have inserted.</p></dd>
<dt><span>caret range</span></dt>
<dd><p>null</p></dd>
</dl>
</li>
<li>
<p>Otherwise, return a <span>caret position</span> where the
<span>caret range</span> is a collapsed
<code data-anolis-spec=dom>Range</code> object for the position
where the text insertion point indicator would have been inserted and
the other properties are set as follows:</p>
<dl>
<dt><span>caret node</span></dt>
<dd><p>The <code data-anolis-spec=dom title=dom-Range-startContainer>startContainer</code>
of the <span>caret range</span>.</p></dd>
<dt><span>caret offset</span></dt>
<dd><p>The <code data-anolis-spec=dom title=dom-Range-startOffset>startOffset</code> of
the <span>caret range</span>.</p>
</dl>
</li>
</ol>
<p class='note'>The specifics of hit testing are out of scope of this
specification and therefore the exact details of
<code title=dom-Document-elementFromPoint>elementFromPoint()</code> and
<code title=dom-Document-caretPositionFromPoint>caretPositionFromPoint()</code>
are therefore too. Hit testing will hopefully be defined in a future
revision of CSS or HTML.</p>
<h3>The <code title>CaretPosition</code> Interface</h3>
<p>A <dfn>caret position</dfn> gives the position of a text insertion point indicator. It always has an associated
<dfn>caret node</dfn>, <dfn>caret offset</dfn>, and <dfn>caret range</dfn>. It is represented by a <code>CaretPosition</code> object.</p>
<pre class=idl>interface <dfn>CaretPosition</dfn> {
readonly attribute <span data-anolis-spec=dom>Node</span> <span title=dom-CaretPosition-offsetNode>offsetNode</span>;
readon 94F5 ly attribute unsigned long <span title=dom-CaretPosition-offset>offset</span>;
<span>ClientRect</span>? <span title=dom-CaretPosition-getClientRect>getClientRect</span>();
};</pre>
<p>The <dfn title=dom-CaretPosition-offsetNode><code>offsetNode</code></dfn> attribute must return the <span>caret node</span>.</p>
<p>The <dfn title=dom-CaretPosition-offset><code>offset</code></dfn> attribute must return the <span>caret offset</span>.</p>
<p>The <dfn title=dom-CaretPosition-getClientRect><code>getClientRect()</code></dfn> method must follow these steps, aborting on the first step that
returns a value:</p>
<ol>
<li>
<p>If <span>caret range</span> is not null:
<ol>
<li><p>Let <var>list</var> be the result of invoking the
<code title=dom-Range-getClientRects>getClientRects()</code> method on the
range.
<li><p>If <var>list</var> is empty, return null.
<li><p>Return the <code>ClientRect</code> object in <var>list</var> at index 0.
</ol>
<li><p>If <span>caret node</span> is a text entry widget that is a replaced element,
and that is in the document, return a <code>ClientRect</code> object for the caret
in the widget as represented by the <span>caret offset</span> value.
<li><p>Return null.
</ol>
<h2>Extensions to the <code title>Element</code> Interface</h2>
<pre class=idl>dictionary <dfn>ScrollOptionsHorizontal</dfn> : <span>ScrollOptions</span> {
double x;
};
dictionary <dfn>ScrollOptionsVertical</dfn> : <span>ScrollOptions</span> {
double y;
};
partial interface <span data-anolis-spec=dom>Element</span> {
<span>ClientRectList</span> <span title=dom-Element-getClientRects>getClientRects</span>();
<span>ClientRect</span> <span title=dom-Element-getBoundingClientRect>getBoundingClientRect</span>();
void <span title=dom-Element-scrollIntoView>scrollIntoView</span>(optional boolean top = true, optional <span>ScrollOptions</span> options);
attribute (double or <span>ScrollOptionsVertical</span>) <span title=dom-Element-scrollTop>scrollTop</span>;
attribute (double or <span>ScrollOptionsHorizontal</span>) <span title=dom-Element-scrollLeft>scrollLeft</span>;
readonly attribute double <span title=dom-Element-scrollWidth>scrollWidth</span>;
readonly attribute double <span title=dom-Element-scrollHeight>scrollHeight</span>;
readonly attribute double <span title=dom-Element-clientTop>clientTop</span>;
readonly attribute double <span title=dom-Element-clientLeft>clientLeft</span>;
readonly attribute double <span title=dom-Element-clientWidth>clientWidth</span>;
readonly attribute double <span title=dom-Element-clientHeight>clientHeight</span>;
};</pre>
<p>The <dfn title=dom-Element-getClientRects><code>getClientRects()</code></dfn> method, when invoked, must return the result of the following algorithm:</p>
<ol>
<li><p>If the element on which it was invoked does not have an associated
<span>layout box</span> return an empty <code>ClientRectList</code> object and stop
this algorithm.</p></li>
<li><p>If the element has an associated <span>SVG layout box</span> return a
<code>ClientRectList</code> object containing a single
<code>ClientRect</code> object that describes the bounding box of the
element as defined by the SVG specification.
<span data-anolis-ref>SVG</span></li>
<li>
<p>Return a <code>ClientRectList</code> object containing a list of
<code>ClientRect</code> objects in content order describing the border
boxes (including those with a height or width of zero) with the
following constraints:</p>
<ul>
<li><p>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.</li>
<li><p>Replace each
<a href='http://www.w3.org/TR/CSS21/visuren.html#anonymous-block-level'>anonymous
block box</a> with its child box(es) and repeat this until no anonymous
block boxes are left in the final list.</li>
</ul>
</li>
</ol>
<p>The <dfn title=dom-Element-getBoundingClientRect><code>getBoundingClientRect()</code></dfn> method, when invoked, must return the result of the following
algorithm:</p>
<ol>
<li><p>Let <var>list</var> be the result of invoking
<code title=dom-Element-getClientRects>getClientRects()</code> on the
same element this method was invoked on.</p></li>
<li><p>If the <var>list</var> is empty return a <code>ClientRect</code>
object whose <code title=dom-ClientRect-top>top</code>,
<code title=dom-ClientRect-right>right</code>,
<code title=dom-ClientRect-bottom>bottom</code> and
<code title=dom-ClientRect-left>left</code> members are zero.</p></li>
<li><p>Otherwise, return a <code>ClientRect</code> object describing the
smallest rectangle that includes the first rectangle in <var>list</var>
and all of the remaining rectangles of which the height or width is not