You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<h3id="the-domrect-and-domrectreadonly-interfaces"><spanclass="secno">11.2 </span>The <codetitle="">DOMRect</code> and <codetitle="">DOMRectReadOnly</code> Interfaces</h3>
1614
1614
1615
-
<p>Objects implementing the <code><ahref="#domrect">DOMRect</a></code> or <code><ahref="#domrectreadonly">DOMRectReadOnly</a></code> interface represent a rectangular box. The type of box is specified by the
1616
-
method or attribute that returns a <code><ahref="#domrect">DOMRect</a></code> or <code><ahref="#domrectreadonly">DOMRectReadOnly</a></code> object. The interfaces are identical except the attributes of
1617
-
<code><ahref="#domrectreadonly">DOMRectReadOnly</a></code> are readonly.
1615
+
<p>Objects implementing the <code><ahref="#domrect">DOMRect</a></code> or <code><ahref="#domrectreadonly">DOMRectReadOnly</a></code> interface represent a <dfnid="concept-geometry-rectangle" title="concept-geometry-rectangle">rectangle</dfn>.
1616
+
The type of box is specified by the method or attribute that returns a <code><ahref="#domrect">DOMRect</a></code> or <code><ahref="#domrectreadonly">DOMRectReadOnly</a></code> object. The interfaces are identical
1617
+
except the attributes of <code><ahref="#domrectreadonly">DOMRectReadOnly</a></code> are readonly.
<dd><p>When the rectangle has a non-negative <ahref="#concept-geometry-rectangle-width" title="concept-geometry-rectangle-width">width</a>, the rectangle's horizontal origin is the left edge;
1624
+
otherwise, it is the right edge. Similarly, when the rectangle has a non-negative <ahref="#concept-geometry-rectangle-height" title="concept-geometry-rectangle-height">height</a>, the rectangle's
1625
+
vertical origin is the top edge; otherwise, it is the bottom edge.
<dd><p>The horizontal distance between the <ahref="#viewport">viewport</a>'s left edge and the rectangle's <ahref="#concept-geometry-rectangle-origin" title="concept-geometry-rectangle-origin">origin</a>.
<dd><p>The vertical distance between the <ahref="#viewport">viewport</a>'s top edge and the rectangle's <ahref="#concept-geometry-rectangle-origin" title="concept-geometry-rectangle-origin">origin</a>.
typedef (<ahref="#domrect">DOMRect</a> or <ahref="#domrectreadonly">DOMRectReadOnly</a>) <dfnid="domrectany">DOMRectAny</dfn>;</pre>
1640
1661
1641
-
<pclass="atrisk">The <dfnid="dom-domrect" title="dom-DOMRect"><code>DOMRect(<var>left</var>, <var>top</var>, <var>width</var>, <var>height</var>)</code></dfn> constructor, when
1662
+
<pclass="atrisk">The <dfnid="dom-domrect" title="dom-DOMRect"><code>DOMRect(<var>x</var>, <var>y</var>, <var>width</var>, <var>height</var>)</code></dfn> constructor, when
1642
1663
invoked, must run the following steps:
1643
1664
1644
1665
<ol>
1645
-
<li><p>Let <var>right</var> be <var>left</var> plus <var>width</var>.
1646
-
<li><p>Let <var>bottom</var> be <var>top</var> plus <var>height</var>.
1647
-
<li><p>Return a new <code><ahref="#domrect">DOMRect</a></code> object with <ahref="#dom-domrect-top" title="dom-DOMRect-top">top</a> set to <var>top</var>, <ahref="#dom-domrect-right" title="dom-DOMRect-right">right</a>
1648
-
set to <var>right</var>, <ahref="#dom-domrect-bottom" title="dom-DOMRect-bottom">bottom</a> set to <var>bottom</var> and <ahref="#dom-domrect-left" title="dom-DOMRect-left">left</a> set to
1649
-
<var>left</var>.
1666
+
<li><p>Return a new <code><ahref="#domrect">DOMRect</a></code> object with <ahref="#concept-geometry-rectangle-x-coordinate" title="concept-geometry-rectangle-x-coordinate">x coordinate</a> set to <var>x</var>,
1667
+
<ahref="#concept-geometry-rectangle-x-coordinate" title="concept-geometry-rectangle-x-coordinate">y coordinate</a> set to <var>y</var>, <ahref="#concept-geometry-rectangle-width" title="concept-geometry-rectangle-width">width</a> set to
1668
+
<var>width</var> and <ahref="#concept-geometry-rectangle-height" title="concept-geometry-rectangle-height">height</a> set to <var>height</var>.
1650
1669
</ol>
1651
1670
1652
-
<p>The <dfnid="dom-domrect-top" title="dom-DOMRect-top"><code>top</code></dfn> attribute gives the y-coordinate, relative to the <ahref="#viewport">viewport</a> origin, of the top of
1653
-
the rectangle box. On getting, it must return the current value. On setting, the current value must be set to the new value.</p>
1671
+
<p>The <dfnid="dom-domrect-x" title="dom-DOMRect-x"><code>x</code></dfn> attribute, on getting, it must return the <ahref="#concept-geometry-rectangle-x-coordinate" title="concept-geometry-rectangle-x-coordinate">x
1672
+
coordinate</a>. On setting, the <ahref="#concept-geometry-rectangle-x-coordinate" title="concept-geometry-rectangle-x-coordinate">x coordinate</a> must be set to the new value.</p>
1673
+
1674
+
<p>The <dfnid="dom-domrect-y" title="dom-DOMRect-y"><code>y</code></dfn> attribute, on getting, it must return the <ahref="#concept-geometry-rectangle-y-coordinate" title="concept-geometry-rectangle-y-coordinate">y
1675
+
coordinate</a>. On setting, the <ahref="#concept-geometry-rectangle-y-coordinate" title="concept-geometry-rectangle-y-coordinate">y coordinate</a> must be set to the new value.</p>
1676
+
1677
+
<p>The <dfnid="dom-domrect-width" title="dom-DOMRect-width"><code>width</code></dfn> attribute, on getting, must return the <ahref="#concept-geometry-rectangle-width" title="concept-geometry-rectangle-width">width</a>.
1678
+
On setting, the <ahref="#concept-geometry-rectangle-width" title="concept-geometry-rectangle-width">width</a> must be set to the new value.
1654
1679
1655
-
<p>The <dfnid="dom-domrect-right" title="dom-DOMRect-right"><code>right</code></dfn> attribute gives the x-coordinate, relative to the <ahref="#viewport">viewport</a> origin, of the
1656
-
right of the rectangle box. On getting, it must return the current value. On setting, the current value must be set to the new value.</p>
1680
+
<p>The <dfnid="dom-domrect-height" title="dom-DOMRect-height"><code>height</code></dfn> attribute, on getting, must return the
1681
+
<ahref="#concept-geometry-rectangle-height" title="concept-geometry-rectangle-height">height</a>. On setting, the <ahref="#concept-geometry-rectangle-height" title="concept-geometry-rectangle-height">height</a> must be set to the new
1682
+
value.
1657
1683
1658
-
<p>The <dfnid="dom-domrect-bottom" title="dom-DOMRect-bottom"><code>bottom</code></dfn> attribute gives the y-coordinate, relative to the <ahref="#viewport">viewport</a> origin, of the
1659
-
bottom of the rectangle box. On getting, it must return the current value. On setting, the current value must be set to the new value.</p>
1684
+
<p>The <dfnid="dom-domrect-top" title="dom-DOMRect-top"><code>top</code></dfn> attribute, on getting, must return min(<ahref="#concept-geometry-rectangle-y-coordinate" title="concept-geometry-rectangle-y-coordinate">y
<p>The <dfnid="dom-domrect-left" title="dom-DOMRect-left"><code>left</code></dfn> attribute gives the x-coordinate, relative to the <ahref="#viewport">viewport</a> origin, of the left
1662
-
of the rectangle box. On getting, it must return the current value. On setting, the current value must be set to the new value.</p>
1687
+
<p>The <dfnid="dom-domrect-right" title="dom-DOMRect-right"><code>right</code></dfn> attribute, on getting, must return max(<ahref="#concept-geometry-rectangle-x-coordinate" title="concept-geometry-rectangle-x-coordinate">x
<p>The <dfnid="dom-domrect-width" title="dom-DOMRect-width"><code>width</code></dfn> attribute, on getting, must return the value of <codetitle="dom-DOMRect-right"><ahref="#dom-domrect-right">right</a></code> minus
1665
-
<codetitle="dom-DOMRect-left"><ahref="#dom-domrect-left">left</a></code>. On setting, the <codetitle="dom-DOMRect-right"><ahref="#dom-domrect-right">right</a></code> attribute must be set to the new value plus the value of
<p>The <dfnid="dom-domrect-bottom" title="dom-DOMRect-bottom"><code>bottom</code></dfn> attribute, on getting, must return max(<ahref="#concept-geometry-rectangle-y-coordinate" title="concept-geometry-rectangle-y-coordinate">y
<p>The <dfnid="dom-domrect-height" title="dom-DOMRect-height"><code>height</code></dfn> attribute, on getting, must return the value of <codetitle="dom-DOMRect-bottom"><ahref="#dom-domrect-bottom">bottom</a></code>
1669
-
minus <codetitle="dom-DOMRect-top"><ahref="#dom-domrect-top">top</a></code>. On setting, the <codetitle="dom-DOMRect-bottom"><ahref="#dom-domrect-bottom">bottom</a></code> attribute must be set to the new value plus the value
1670
-
of <codetitle="dom-DOMRect-top"><ahref="#dom-domrect-top">top</a></code>.</p>
1693
+
<p>The <dfnid="dom-domrect-left" title="dom-DOMRect-left"><code>left</code></dfn> attribute, on getting, must return min(<ahref="#concept-geometry-rectangle-x-coordinate" title="concept-geometry-rectangle-x-coordinate">x
<dfnid="dom-domrectreadonly-width" title="dom-DOMRectReadOnly-width"><code>width</code></dfn> and <dfnid="dom-domrectreadonly-height" title="dom-DOMRectReadOnly-height"><code>height</code></dfn> attributes of the
<dfnid="dom-domrectreadonly-bottom" title="dom-DOMRectReadOnly-bottom"><code>bottom</code></dfn> and <dfnid="dom-domrectreadonly-left" title="dom-DOMRectReadOnly-left"><code>left</code></dfn> attributes of the
1675
1700
<code><ahref="#domrectreadonly">DOMRectReadOnly</a></code> interface, on getting, must behave the same as the attribute of the same name on the <code><ahref="#domrect">DOMRect</a></code> interface.
0 commit comments