Skip to content

Commit 870ff9a

Browse files
committed
first ever attempted definition of getComputedStyle
1 parent fd13cd7 commit 870ff9a

2 files changed

Lines changed: 83 additions & 20 deletions

File tree

cssom/Overview.html

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,7 +1480,7 @@ <h4 id=extensions-to-the-document-interface><span class=secno>5.2.3.
14801480
representing the <a href="#document-style-sheets">document style
14811481
sheets</a>.
14821482

1483-
<p class=note>Because of IDL limitations the <a
1483+
<p class=note>Because of historical IDL limitations the <a
14841484
href="#dom-document-stylesheets"><code
14851485
title=dom-Document-styleSheets>styleSheets</code></a> attribute used to be
14861486
on a separate interface, <code title="">DocumentStyle</code>.
@@ -3963,19 +3963,54 @@ <h3 id=extensions-to-the-window-interface><span class=secno>6.2.
39633963
<a href="#cssstyledeclaration">CSSStyleDeclaration</a> <a href="#dom-window-getcomputedstyle" title=dom-Window-getComputedStyle>getComputedStyle</a>(Element <var title="">elt</var>, DOMString <var title="">pseudoElt</var>);
39643964
};</pre>
39653965

3966-
<p class=XXX>The <dfn id=dom-window-getcomputedstyle
3966+
<p>The <dfn id=dom-window-getcomputedstyle
39673967
title=dom-Window-getComputedStyle><code>getComputedStyle(<var
39683968
title="">elt</var>, <var title="">pseudoElt</var>)</code></dfn> method <em
3969-
class=ct>must</em> ...</p>
3970-
<!-- XXX
3969+
class=ct>must</em> run these steps:
39713970

3972-
element not in rendered document
3973-
element in subtree
3974-
element moved out of document
3975-
element moved into document
3976-
-->
3971+
<ol>
3972+
<li>
3973+
<p>Let <var title="">doc</var> be the <code>Document</code> associated
3974+
with the <code>Window</code> object on which the method was invoked.
3975+
3976+
<li>
3977+
<p>Let <var title="">obj</var> be <var title="">elt</var>.
3978+
3979+
<li>
3980+
<p>If <var title="">pseudoElt</var> is as an <a
3981+
href="#ascii-case-insensitive">ASCII case-insensitive</a> match for
3982+
either "<code>:before</code>" or "<code>::before</code>" let <var
3983+
title="">obj</var> be the '::before' pseudo-element of <var
3984+
title="">elt</var>.
3985+
3986+
<li>
3987+
<p>If <var title="">pseudoElt</var> is as an <a
3988+
href="#ascii-case-insensitive">ASCII case-insensitive</a> match for
3989+
either "<code>:after</code>" or "<code>::after</code>" let <var
3990+
title="">obj</var> be the '::after' pseudo-element of <var
3991+
title="">elt</var>.
3992+
3993+
<li>
3994+
<p>Return a <a href="#css-declaration-block">CSS declaration block</a>
3995+
with the <a href="#css-declaration-block-readonly-flag">CSS declaration
3996+
block readonly flag</a> set to true and the <a
3997+
href="#css-declaration-block-declarations">CSS declaration block
3998+
declarations</a> set to all properties the user agent supports with as
3999+
value the <a href="#resolved-value">resolved value</a> computed for <var
4000+
title="">obj</var> using the style rules associated with <var
4001+
title="">d</var>.</p>
4002+
4003+
<p class=note>This means that even if <var title="">obj</var> is in a
4004+
different document (e.g. one fetched via <code>XMLHttpRequest</code>) it
4005+
will still use the style rules associated with the document that is
4006+
associated with the global object on which <a
4007+
href="#dom-window-getcomputedstyle"><code
4008+
title=dom-Window-getComputedStyle>getComputedStyle()</code></a> was
4009+
invoked to compute the <a href="#css-declaration-block">CSS declaration
4010+
block</a>.</p>
4011+
</ol>
39774012

3978-
<p class=note>Because of IDL limitations the <a
4013+
<p class=note>Because of historical IDL limitations the <a
39794014
href="#dom-window-getcomputedstyle"><code
39804015
title=dom-Window-getComputedStyle>getComputedStyle()</code></a> method
39814016
used to be on a separate interface, <code title="">ViewCSS</code>.

cssom/Overview.src.html

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,7 @@ <h4>Extensions to the <code title="">Document</code> Interface</h4>
11231123
attribute <em class="ct">must</em> return a <code>StyleSheetList</code>
11241124
sequence representing the <span>document style sheets</span>.</p>
11251125

1126-
<p class="note">Because of IDL limitations the
1126+
<p class="note">Because of historical IDL limitations the
11271127
<code title="dom-Document-styleSheets">styleSheets</code> attribute used
11281128
to be on a separate interface, <code title="">DocumentStyle</code>.</p>
11291129

@@ -2516,19 +2516,47 @@ <h3>Extensions to the <code title="">Window</code> Interface</h3>
25162516
<span>CSSStyleDeclaration</span> <span title="dom-Window-getComputedStyle">getComputedStyle</span>(Element <var title="">elt</var>, DOMString <var title="">pseudoElt</var>);
25172517
};</pre>
25182518

2519-
<p class="XXX">The
2519+
<p>The
25202520
<dfn id="dom-window-getcomputedstyle" title="dom-Window-getComputedStyle"><code>getComputedStyle(<var title="">elt</var>, <var title="">pseudoElt</var>)</code></dfn>
2521-
method <em class="ct">must</em> ...</p>
2521+
method <em class="ct">must</em> run these steps:</p>
2522+
2523+
<ol>
2524+
<li><p>Let <var title="">doc</var> be the <code>Document</code>
2525+
associated with the <code>Window</code> object on which the method was
2526+
invoked.</p></li>
25222527

2523-
<!-- XXX
2528+
<li><p>Let <var title="">obj</var> be <var title="">elt</var>.</p></li>
25242529

2525-
element not in rendered document
2526-
element in subtree
2527-
element moved out of document
2528-
element moved into document
2529-
-->
2530+
<li><p>If <var title="">pseudoElt</var> is as an
2531+
<span>ASCII case-insensitive</span> match for either
2532+
"<code>:before</code>" or "<code>::before</code>" let
2533+
<var title="">obj</var> be the '::before' pseudo-element of
2534+
<var title="">elt</var>.</p></li>
2535+
2536+
<li><p>If <var title="">pseudoElt</var> is as an
2537+
<span>ASCII case-insensitive</span> match for either
2538+
"<code>:after</code>" or "<code>::after</code>" let
2539+
<var title="">obj</var> be the '::after' pseudo-element of
2540+
<var title="">elt</var>.</p></li>
2541+
2542+
<li>
2543+
<p>Return a <span>CSS declaration block</span> with the
2544+
<span>CSS declaration block readonly flag</span> set to true and the
2545+
<span>CSS declaration block declarations</span> set to all properties
2546+
the user agent supports with as value the <span>resolved value</span>
2547+
computed for <var title="">obj</var> using the style rules associated
2548+
with <var title="">d</var>.</p>
2549+
2550+
<p class="note">This means that even if <var title="">obj</var> is in a
2551+
different document (e.g. one fetched via <code>XMLHttpRequest</code>) it
2552+
will still use the style rules associated with the document that is
2553+
associated with the global object on which
2554+
<code title="dom-Window-getComputedStyle">getComputedStyle()</code> was
2555+
invoked to compute the <span>CSS declaration block</span>.</p>
2556+
</li>
2557+
</ol>
25302558

2531-
<p class="note">Because of IDL limitations the
2559+
<p class="note">Because of historical IDL limitations the
25322560
<code title="dom-Window-getComputedStyle">getComputedStyle()</code> method
25332561
used to be on a separate interface, <code title="">ViewCSS</code>.</p>
25342562

0 commit comments

Comments
 (0)