Skip to content

Commit 1009185

Browse files
committed
fix definitions of offset attributes a bit
1 parent d966395 commit 1009185

2 files changed

Lines changed: 200 additions & 146 deletions

File tree

cssom/Overview.html

Lines changed: 109 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -276,18 +276,8 @@ <h2 class="no-num no-toc" id=toc>Table of Contents</h2>
276276
</span>The <code>TextRectangle</code> Interface</a>
277277
</ul>
278278

279-
<li><a href="#the-offset"><span class=secno>4.3.2. </span>The
280-
<code>offset<var>*</var></code> attributes</a>
281-
<ul class=toc>
282-
<li><a href="#determining"><span class=secno>4.3.2.1.
283-
</span>Determining <code>offsetParent</code></a>
284-
285-
<li><a href="#offsettop"><span class=secno>4.3.2.2.
286-
</span><code>offsetTop</code> and <code>offsetLeft</code></a>
287-
288-
<li><a href="#offsetwidth"><span class=secno>4.3.2.3.
289-
</span><code>offsetWidth</code> and <code>offsetHeight</code></a>
290-
</ul>
279+
<li><a href="#the-offset"><span class=secno>4.3.2. </span>The <code
280+
title="">offset<var title="">*</var></code> attributes</a>
291281

292282
<li><a href="#the-scroll"><span class=secno>4.3.3. </span>The
293283
<code>scroll<var>*</var></code> attributes</a>
@@ -2426,9 +2416,10 @@ <h5 id=the-textrectanglelist><span class=secno>4.3.1.1. </span>The <code><a
24262416
};</pre>
24272417

24282418
<p>The <dfn id=textrectanglelist-length
2429-
title=textrectanglelist-length><code>length</code> attribute <em
2430-
class=ct>must</em> return the number of <code>TextRectangle</code> objects
2431-
associated with the object.</dfn>
2419+
title=textrectanglelist-length><code>length</code></dfn> attribute <em
2420+
class=ct>must</em> return the number of <code><a
2421+
href="#textrectangle">TextRectangle</a></code> objects associated with the
2422+
object.
24322423

24332424
<p>The <dfn id=textrectanglelist-item
24342425
title=textrectanglelist-item><code>item(<var
@@ -2450,12 +2441,16 @@ <h5 id=the-textrectanglelist><span class=secno>4.3.1.1. </span>The <code><a
24502441
<h5 id=the-textrectangle><span class=secno>4.3.1.2. </span>The <code><a
24512442
href="#textrectangle">TextRectangle</a></code> Interface</h5>
24522443

2444+
<p>Objects implementing the <code><a
2445+
href="#textrectangle">TextRectangle</a></code> interface represent a
2446+
rectangular layout box.
2447+
24532448
<pre class=idl>interface <dfn id=textrectangle>TextRectangle</dfn> {
24542449
readonly attribute float <a href="#textrectangle-top" title=textrectangle-top>top</a>;
24552450
readonly attribute float <a href="#textrectangle-right" title=textrectangle-right>right</a>;
24562451
readonly attribute float <a href="#textrectangle-bottom" title=textrectangle-bottom>bottom</a>;
24572452
readonly attribute float <a href="#textrectangle-left" title=textrectangle-left>left</a>;
2458-
}</pre>
2453+
};</pre>
24592454

24602455
<p>The <dfn id=textrectangle-top
24612456
title=textrectangle-top><code>top</code></dfn> attribute, on getting, <em
@@ -2477,82 +2472,114 @@ <h5 id=the-textrectangle><span class=secno>4.3.1.2. </span>The <code><a
24772472
<em class=ct>must</em> return the distance between the left of the
24782473
viewport and the left of the rectangle box.
24792474

2480-
<h4 id=the-offset><span class=secno>4.3.2. </span>The
2481-
<code>offset<var>*</var></code> attributes</h4>
2482-
2483-
<h5 id=determining><span class=secno>4.3.2.1. </span>Determining <code><a
2484-
href="#elementlayout-offsetparent">offsetParent</a></code></h5>
2475+
<h4 id=the-offset><span class=secno>4.3.2. </span>The <code
2476+
title="">offset<var title="">*</var></code> attributes</h4>
24852477

24862478
<p>The <dfn id=elementlayout-offsetparent><code>offsetParent</code></dfn>
2487-
attribute for element <var>A</var> when <var>A</var> is <span>the
2488-
<code>html</code> element</span><!-- XXX ref --> or <span>the
2489-
<code>body</code> element</span> <!-- XXX or Map when used for image maps
2490-
-->
2491-
or its computed value of the <code>position</code> property is
2492-
<code>fixed</code> <em class=ct>must</em> be <code>null</code>.</p>
2493-
<!--
2494-
When node A implements the HTMLAreaElement when it's used for image maps
2495-
offsetParent must be the corresponding HTMLMapElement.
2496-
-->
2479+
attribute, when called on element <var title="">A</var>, <em
2480+
class=ct>must</em> return the element determined by the following
2481+
algorithm:
24972482

2498-
<p>Otherwise, the <code><a
2499-
href="#elementlayout-offsetparent">offsetParent</a></code> attribute of
2500-
<var>A</var> <em class=ct>must</em> be the nearest ancestor for which at
2501-
least one of the following is true:
2483+
<ol>
2484+
<li>
2485+
<p>If any of the following holds true return <code>null</code> and stop
2486+
this algorithm:</p>
25022487

2503-
<ul>
2504-
<li>The computed value of the <code>position</code> property of the
2505-
ancestor is not <code>static</code>.
2488+
<ul>
2489+
<li><var title="">A</var> is the root element.
25062490

2507-
<li>The ancestor is <span>the <code>body</code> element</span>.
2491+
<li><var title="">A</var> is the <code>body</code> element. [HTML5]
2492+
2493+
<li>The computed value of the <code>position</code> property for element
2494+
<var title="">A</var> is <code>fixed</code>.
2495+
</ul>
25082496

25092497
<li>
2510-
<p>The computed value of the <code>position</code> property of
2511-
<var>A</var> is <code>static</code> and the ancestor is one of the
2512-
following HTML elements: <code>td</code>, <code>th</code> or
2513-
<code>table</code>.
2514-
</ul>
2498+
<p>If <var title="">A</var> is an <code>area</code> element in the
2499+
<code>http://www.w3.org/1999/xhtml</code> namespace which has a
2500+
<code>map</code> element somewhere in the ancestor chain return the
2501+
nearest ancestor <code>map</code> element and stop this algorithm.
25152502

2516-
<p>If no such ancestor is found <code><a
2517-
href="#elementlayout-offsetparent">offsetParent</a></code> <em
2518-
class=ct>must</em> be <code>null</code>.
2503+
<li>
2504+
<p>Return the nearest ancestor element of <var title="">A</var> for which
2505+
at least one of the following is true and stop this algorithm if such an
2506+
ancestor is found:</p>
2507+
2508+
<ul>
2509+
<li>The computed value of the <code>position</code> property is not
2510+
<code>static</code>.
2511+
2512+
<li>It is the <code>body</code> element. [HTML5]
2513+
2514+
<li>The computed value of the <code>position</code> property of <var
2515+
title="">A</var> is <code>static</code> and the ancestor is one of the
2516+
following elements in the <code>http://www.w3.org/1999/xhtml</code>
2517+
namespace: <code>td</code>, <code>th</code> or <code>table</code>.
2518+
</ul>
25192519

2520-
<h5 id=offsettop><span class=secno>4.3.2.2. </span><code><a
2521-
href="#elementlayout-offsettop">offsetTop</a></code> and <code><a
2522-
href="#elementlayout-offsetleft">offsetLeft</a></code></h5>
2520+
<li>
2521+
<p>Return <code>null</code>.
2522+
</ol>
25232523
<!--XXX add something about the assumption that nothing is scrolled here?-->
25242524

25252525
<p>The <dfn id=elementlayout-offsettop><code>offsetTop</code></dfn>
2526-
attribute of <code>Element</code> node <var>A</var> <em class=ct>must</em>
2527-
be the number of pixels that the top border edge of <var>A</var> is below
2528-
the top border edge of <code><var>A</var>.offsetParent</code>. If
2529-
<code><var>A</var>.offsetParent</code> is <code>null</code> or represents
2530-
<span>the <code>body</code> element</span><!-- XXX ref--> it <em
2531-
class=ct>must</em> be the number of pixels that the top border edge of
2532-
<var>A</var> is below the origin (0,0) of the initial containing block.
2526+
attribute, when called on element <var title="">A</var>, <em
2527+
class=ct>must</em> return the value that is the result of the following
2528+
algorithm:
2529+
2530+
<ol>
2531+
<li>
2532+
<p>If element <var title="">A</var> is the <code>body</code> element or
2533+
its computed value of the <code>display</code> propery is
2534+
<code>none</code> return zero and stop this algorithm.
2535+
2536+
<li>
2537+
<p>If the <code><a
2538+
href="#elementlayout-offsetparent">offsetParent</a></code> of element
2539+
<var title="">A</var> is <code>null</code> or the <code>body</code>
2540+
element return the distance in CSS pixels as float between the top
2541+
border edge of element <var title="">A</var> and the top of the initial
2542+
containing block and stop this algorithm. [HTML5]
2543+
2544+
<li>
2545+
<p>Return the distance in CSS pixels as float between the top border edge
2546+
of the <code><a
2547+
href="#elementlayout-offsetparent">offsetParent</a></code> of element
2548+
<var title="">A</var> and the top border edge of element <var
2549+
title="">A</var>.
2550+
</ol>
25332551

25342552
<p>The <dfn id=elementlayout-offsetleft><code>offsetLeft</code></dfn>
2535-
attribute of <code>Element</code> node <var>A</var> <em class=ct>must</em>
2536-
be the number of pixels that the top border edge of <var>A</var> is to the
2537-
right of the top border edge of <code><var>A</var>.offsetParent</code>. If
2538-
<code><var>A</var>.offsetParent</code> is <code>null</code> or represents
2539-
<span>the <code>body</code> element</span><!-- XXX ref--> it <em
2540-
class=ct>must</em> be the number of pixels that the top border edge of
2541-
<var>A</var> is to the right of the origin (0,0) of the initial containing
2542-
block.
2543-
2544-
<p>When <var>A</var> is <span>the <code>body</code> element</span> <code><a
2545-
href="#elementlayout-offsettop">offsetTop</a></code> and <code><a
2546-
href="#elementlayout-offsetleft">offsetLeft</a></code> <em
2547-
class=ct>must</em> be <code>null</code>.
2548-
2549-
<p class=issue>See source code for some remarks on <code>html:map</code>
2553+
attribute, when caled on element <var title="">A</var>, <em
2554+
class=ct>must</em> return the value that is the result of the following
2555+
algorithm:
2556+
2557+
<ol>
2558+
<li>
2559+
<p>If element <var title="">A</var> is the <code>body</code> element or
2560+
its computed value of the <code>display</code> propery is
2561+
<code>none</code> return zero and stop this algorithm. [HTML5]
2562+
2563+
<li>
2564+
<p>If the <code><a
2565+
href="#elementlayout-offsetparent">offsetParent</a></code> of element
2566+
<var title="">A</var> is <code>null</code> or the <code>body</code>
2567+
element return the distance in CSS pixels as float between the left
2568+
border edge of element <var title="">A</var> and the left of the initial
2569+
containing block and stop this algorithm. [HTML5]
2570+
2571+
<li>
2572+
<p>Return the distance in CSS pixels as float between the left border
2573+
edge of the <code><a
2574+
href="#elementlayout-offsetparent">offsetParent</a></code> of element
2575+
<var title="">A</var> and the left border edge of element <var
2576+
title="">A</var>.
2577+
</ol>
2578+
2579+
<p class=issue>See source code for some remarks on <code>html:area</code>
25502580
elements.</p>
25512581
<!--
2552-
They must also be 0 when A implements the HTMLMapElement interface and is
2553-
used as an image map. When node A implements the HTMLAreaElement interface
2554-
and is used for image maps offsetLeft and offsetTop must be determined as
2555-
follows:
2582+
When html:area has an html:map and that has an associated html:img
25562583
25572584
The shape attribute is set to default
25582585
offsetLeft and offsetTop are 0.
@@ -2563,17 +2590,15 @@ <h5 id=offsettop><span class=secno>4.3.2.2. </span><code><a
25632590
offsetLeft is the minimum of all x values and offsetTop is the minimum of all y values.
25642591
-->
25652592

2566-
<h5 id=offsetwidth><span class=secno>4.3.2.3. </span><code><a
2567-
href="#elementlayout-offsetwidth">offsetWidth</a></code> and <code><a
2568-
href="#elementlayout-offsetheight">offsetHeight</a></code></h5>
2569-
25702593
<p>The <dfn id=elementlayout-offsetwidth><code>offsetWidth</code></dfn>
2571-
attribute of element <var>A</var> <em class=ct>must</em> be the number of
2572-
pixels given by the border box width<!--XXX ref-->.
2594+
attribute, when called, <em class=ct>must</em> return the number of CSS
2595+
pixels of the border box width of the element on which the attribute was
2596+
called. <!--XXX ref-->
25732597

25742598
<p>The <dfn id=elementlayout-offsetheight><code>offsetHeight</code></dfn>
2575-
attribute of element <var>A</var> <em class=ct>must</em> be the number of
2576-
pixels given by the border box height<!--XXX ref-->.
2599+
attribute, when caled, <em class=ct>must</em> return be the number of CSS
2600+
pixels of the border box height of the element on which the attribute was
2601+
called. <!--XXX ref-->
25772602

25782603
<p class=issue>In quirks mode "the body element" represents the viewport
25792604
height and width here and in standards mode that would be "the html

0 commit comments

Comments
 (0)