Skip to content

Commit 9a8e782

Browse files
author
Simon Pieters
committed
[cssom] Handle shorthands a bit better and specify the order of declarations
1 parent 33d3a74 commit 9a8e782

2 files changed

Lines changed: 30 additions & 30 deletions

File tree

cssom/Overview.html

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1952,7 +1952,9 @@ <h4 id="the-cssstylerule-interface"><span class="secno">6.4.3 </span>The <code t
19521952
<li><p>Otherwise, if the algorithm returns a null value, do nothing.</li>
19531953
</ol>
19541954

1955-
<p>The <dfn id="dom-cssstylerule-style" title="dom-CSSStyleRule-style"><code>style</code></dfn> attribute must return a <code><a href="#cssstyledeclaration">CSSStyleDeclaration</a></code> object for the style rule.</p>
1955+
<p>The <dfn id="dom-cssstylerule-style" title="dom-CSSStyleRule-style"><code>style</code></dfn> attribute must return a <code><a href="#cssstyledeclaration">CSSStyleDeclaration</a></code> object for the style rule, with the
1956+
<a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a> being the declared declarations in the rule, in the same order as they were
1957+
specified, with shorthand properties expanded into their longhand properties, in canonical order.</p>
19561958

19571959

19581960
<h4 id="the-csscharsetrule-interface"><span class="secno">6.4.4 </span>The <code title="">CSSCharsetRule</code> Interface</h4>
@@ -2106,10 +2108,6 @@ <h3 id="css-declaration-blocks"><span class="secno">6.5 </span>CSS Declaration B
21062108
<dd><p>The CSS declarations associated with the object.</dd>
21072109
</dl>
21082110

2109-
<p class="note">The <a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a> are
2110-
ordered. This matters for the
2111-
<code title="dom-CSSStyleDeclaration-item"><a href="#dom-cssstyledeclaration-item">item()</a></code> method.</p>
2112-
21132111
<p>To <dfn id="parse-a-css-declaration-block">parse a CSS declaration block</dfn> from a string <var>string</var>, invoke <a class="external" data-anolis-spec="csssyntax" href="http://dev.w3.org/csswg/css-syntax/#parse-a-list-of-declarations0">parse a list of declarations</a> with
21142112
<var>string</var> and return the value returned.</p>
21152113

@@ -2192,8 +2190,9 @@ <h4 id="the-cssstyledeclaration-interface"><span class="secno">6.5.1 </span>The
21922190
<li><p>If the <a href="#concept-css-declaration-block-readonly-flag" title="concept-css-declaration-block-readonly-flag">readonly flag</a> is set, <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#concept-throw" title="concept-throw">throw</a>
21932191
a <code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#nomodificationallowederror">NoModificationAllowedError</a></code> exception and terminate these steps.</li>
21942192
<li><p>Empty the <a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a>.</li>
2195-
<li><p><a href="#parse-a-css-declaration-block" title="Parse a CSS declaration block">Parse</a> the given value and, if the return value is not the empty list, insert it into the
2196-
<a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a>.</li>
2193+
<li><p><a href="#parse-a-css-declaration-block" title="Parse a CSS declaration block">Parse</a> the given value and, if the return value is not the empty list, insert the items in the list
2194+
into the <a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a>, in the same order as they were specified, with shorthand properties
2195+
expanded into their longhand properties, in canonical order.</li>
21972196
</ol>
21982197

21992198
<p>The <dfn id="dom-cssstyledeclaration-length" title="dom-CSSStyleDeclaration-length"><code>length</code></dfn> attribute must return the number of declarations in the
@@ -2699,7 +2698,8 @@ <h3 id="the-elementcssinlinestyle-interface"><span class="secno">7.1 </span>The
26992698

27002699
<p>The <dfn id="dom-elementcssinlinestyle-style" title="dom-ElementCSSInlineStyle-style"><code>style</code></dfn> attribute must return a <a href="#css-declaration-block">CSS declaration block</a> with the
27012700
<a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a> being set to the result of <a href="#parse-a-css-declaration-block" title="Parse a CSS declaration block">parsing</a>
2702-
the <code title="">style</code> content attribute. If the
2701+
the <code title="">style</code> content attribute, in the same order as specified, with shorthand properties expanded to their longhand properties, in canonical
2702+
order. If the
27032703
<code title="">style</code> content attribute is absent, the object represents an empty list of
27042704
declarations. Mutating the <code><a href="#cssstyledeclaration">CSSStyleDeclaration</a></code> object must set the
27052705
<code title="">style</code> content attribute on the element to the
@@ -2746,7 +2746,7 @@ <h3 id="extensions-to-the-window-interface"><span class="secno">7.2 </span>Exten
27462746
<li>
27472747
<p>Return a <a href="#css-declaration-block">CSS declaration block</a> with the
27482748
<a href="#concept-css-declaration-block-readonly-flag" title="concept-css-declaration-block-readonly-flag">readonly flag</a> set and the
2749-
<a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a> set to all properties
2749+
<a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a> set to all longhand properties
27502750
the user agent supports with the value being the <a href="#resolved-value">resolved value</a>
27512751
computed for <var>obj</var> using the style rules associated
27522752
with <var>doc</var>.</p>
@@ -2781,28 +2781,28 @@ <h3 id="the-getstyleutils-interface"><span class="secno">7.3 </span>The <code ti
27812781

27822782
<p class="atrisk">The <dfn id="dom-getstyleutils-specifiedstyle" title="dom-GetStyleUtils-specifiedStyle"><code>specifiedStyle</code></dfn> attribute must return a <a href="#css-declaration-block">CSS declaration block</a>
27832783
with the <a href="#concept-css-declaration-block-readonly-flag" title="concept-css-declaration-block-readonly-flag">readonly flag</a> set and the
2784-
<a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a> set to all properties
2784+
<a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a> set to all longhand properties
27852785
the user agent supports with the value being the <a href="#specified-value">specified value</a>
27862786
computed for the <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#context-object">context object</a> using the style rules associated
27872787
with the <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#context-object">context object</a>'s <a href="#associated-document">associated document</a>.</p>
27882788

27892789
<p class="atrisk">The <dfn id="dom-getstyleutils-defaultstyle" title="dom-GetStyleUtils-defaultStyle"><code>defaultStyle</code></dfn> attribute must return a <a href="#css-declaration-block">CSS declaration block</a> with
27902790
the <a href="#concept-css-declaration-block-readonly-flag" title="concept-css-declaration-block-readonly-flag">readonly flag</a> set and the
2791-
<a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a> set to all properties the user agent supports with the value being the <a href="#computed-value">computed
2792-
value</a> computed for the <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#context-object">context object</a> using the user-agent-level style rules and user-level style rules associated with
2793-
the <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#context-object">context object</a>'s <a href="#associated-document">associated document</a>, ignoring transitions, animations, author-level style
2791+
<a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a> set to all longhand properties the user agent supports with the value being the
2792+
<a href="#computed-value">computed value</a> computed for the <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#context-object">context object</a> using the user-agent-level style rules and user-level style rules
2793+
associated with the <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#context-object">context object</a>'s <a href="#associated-document">associated document</a>, ignoring transitions, animations, author-level style
27942794
rules, author-level presentational hints and override-level style rules.</p>
27952795

27962796
<p class="atrisk">The <dfn id="dom-getstyleutils-computedstyle" title="dom-GetStyleUtils-computedStyle"><code>computedStyle</code></dfn> attribute must return a <a href="#css-declaration-block">CSS declaration block</a> with
27972797
the <a href="#concept-css-declaration-block-readonly-flag" title="concept-css-declaration-block-readonly-flag">readonly flag</a> set and the
2798-
<a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a> set to all properties
2798+
<a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a> set to all longhand properties
27992799
the user agent supports with the value being the <a href="#computed-value">computed value</a>
28002800
computed for the <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#context-object">context object</a> using the style rules associated
28012801
with the <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#context-object">context object</a>'s <a href="#associated-document">associated document</a>.</p>
28022802

28032803
<p class="atrisk">The <dfn id="dom-getstyleutils-usedstyle" title="dom-GetStyleUtils-usedStyle"><code>usedStyle</code></dfn> attribute must return a <a href="#css-declaration-block">CSS declaration block</a> with the
28042804
<a href="#concept-css-declaration-block-readonly-flag" title="concept-css-declaration-block-readonly-flag">readonly flag</a> set and the
2805-
<a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a> set to all properties
2805+
<a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a> set to all longhand properties
28062806
the user agent supports with the value being the <a href="#used-value">used value</a>
28072807
computed for the <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#context-object">context object</a> using the style rules associated
28082808
with the <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#context-object">context object</a>'s <a href="#associated-document">associated document</a>.</p>

cssom/Overview.src.html

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1874,7 +1874,9 @@ <h4>The <code title>CSSStyleRule</code> Interface</h4>
18741874
<li><p>Otherwise, if the algorithm returns a null value, do nothing.</p></li>
18751875
</ol>
18761876

1877-
<p>The <dfn title=dom-CSSStyleRule-style><code>style</code></dfn> attribute must return a <code>CSSStyleDeclaration</code> object for the style rule.</p>
1877+
<p>The <dfn title=dom-CSSStyleRule-style><code>style</code></dfn> attribute must return a <code>CSSStyleDeclaration</code> object for the style rule, with the
1878+
<span title=concept-css-declaration-block-declarations>declarations</span> being the declared declarations in the rule, in the same order as they were
1879+
specified, with shorthand properties expanded into their longhand properties, in canonical order.</p>
18781880

18791881

18801882
<h4>The <code title>CSSCharsetRule</code> Interface</h4>
@@ -2028,10 +2030,6 @@ <h3>CSS Declaration Blocks</h3>
20282030
<dd><p>The CSS declarations associated with the object.</p></dd>
20292031
</dl>
20302032

2031-
<p class="note">The <span title=concept-css-declaration-block-declarations>declarations</span> are
2032-
ordered. This matters for the
2033-
<code title="dom-CSSStyleDeclaration-item">item()</code> method.</p>
2034-
20352033
<p>To <dfn>parse a CSS declaration block</dfn> from a string <var>string</var>, invoke <span data-anolis-spec=csssyntax>parse a list of declarations</span> with
20362034
<var>string</var> and return the value returned.</p>
20372035

@@ -2114,8 +2112,9 @@ <h4>The <code title>CSSStyleDeclaration</code> Interface</h4>
21142112
<li><p>If the <span title=concept-css-declaration-block-readonly-flag>readonly flag</span> is set, <span data-anolis-spec=dom title=concept-throw>throw</span>
21152113
a <code data-anolis-spec=dom>NoModificationAllowedError</code> exception and terminate these steps.</li>
21162114
<li><p>Empty the <span title=concept-css-declaration-block-declarations>declarations</span>.</li>
2117-
<li><p><span title='Parse a CSS declaration block'>Parse</span> the given value and, if the return value is not the empty list, insert it into the
2118-
<span title=concept-css-declaration-block-declarations>declarations</span>.</p></li>
2115+
<li><p><span title='Parse a CSS declaration block'>Parse</span> the given value and, if the return value is not the empty list, insert the items in the list
2116+
into the <span title=concept-css-declaration-block-declarations>declarations</span>, in the same order as they were specified, with shorthand properties
2117+
expanded into their longhand properties, in canonical order.</p></li>
21192118
</ol>
21202119

21212120
<p>The <dfn title=dom-CSSStyleDeclaration-length><code>length</code></dfn> attribute must return the number of declarations in the
@@ -2621,7 +2620,8 @@ <h3>The <code>ElementCSSInlineStyle</code> Interface</h3>
26212620

26222621
<p>The <dfn title=dom-ElementCSSInlineStyle-style><code>style</code></dfn> attribute must return a <span>CSS declaration block</span> with the
26232622
<span title=concept-css-declaration-block-declarations>declarations</span> being set to the result of <span title='Parse a CSS declaration block'>parsing</span>
2624-
the <code title>style</code> content attribute. If the
2623+
the <code title>style</code> content attribute, in the same order as specified, with shorthand properties expanded to their longhand properties, in canonical
2624+
order. If the
26252625
<code title>style</code> content attribute is absent, the object represents an empty list of
26262626
declarations. Mutating the <code>CSSStyleDeclaration</code> object must set the
26272627
<code title>style</code> content attribute on the element to the
@@ -2668,7 +2668,7 @@ <h3>Extensions to the <code title>Window</code> Interface</h3>
26682668
<li>
26692669
<p>Return a <span>CSS declaration block</span> with the
26702670
<span title=concept-css-declaration-block-readonly-flag>readonly flag</span> set and the
2671-
<span title=concept-css-declaration-block-declarations>declarations</span> set to all properties
2671+
<span title=concept-css-declaration-block-declarations>declarations</span> set to all longhand properties
26722672
the user agent supports with the value being the <span>resolved value</span>
26732673
computed for <var>obj</var> using the style rules associated
26742674
with <var>doc</var>.</p>
@@ -2703,28 +2703,28 @@ <h3>The <code title>GetStyleUtils</code> Interface</h3>
27032703

27042704
<p class=atrisk>The <dfn title=dom-GetStyleUtils-specifiedStyle><code>specifiedStyle</code></dfn> attribute must return a <span>CSS declaration block</span>
27052705
with the <span title=concept-css-declaration-block-readonly-flag>readonly flag</span> set and the
2706-
<span title=concept-css-declaration-block-declarations>declarations</span> set to all properties
2706+
<span title=concept-css-declaration-block-declarations>declarations</span> set to all longhand properties
27072707
the user agent supports with the value being the <span>specified value</span>
27082708
computed for the <span data-anolis-spec=dom>context object</span> using the style rules associated
27092709
with the <span data-anolis-spec=dom>context object</span>'s <span>associated document</span>.</p>
27102710

27112711
<p class=atrisk>The <dfn title=dom-GetStyleUtils-defaultStyle><code>defaultStyle</code></dfn> attribute must return a <span>CSS declaration block</span> with
27122712
the <span title=concept-css-declaration-block-readonly-flag>readonly flag</span> set and the
2713-
<span title=concept-css-declaration-block-declarations>declarations</span> set to all properties the user agent supports with the value being the <span>computed
2714-
value</span> computed for the <span data-anolis-spec=dom>context object</span> using the user-agent-level style rules and user-level style rules associated with
2715-
the <span data-anolis-spec=dom>context object</span>'s <span>associated document</span>, ignoring transitions, animations, author-level style
2713+
<span title=concept-css-declaration-block-declarations>declarations</span> set to all longhand properties the user agent supports with the value being the
2714+
<span>computed value</span> computed for the <span data-anolis-spec=dom>context object</span> using the user-agent-level style rules and user-level style rules
2715+
associated with the <span data-anolis-spec=dom>context object</span>'s <span>associated document</span>, ignoring transitions, animations, author-level style
27162716
rules, author-level presentational hints and override-level style rules.</p>
27172717

27182718
<p class=atrisk>The <dfn title=dom-GetStyleUtils-computedStyle><code>computedStyle</code></dfn> attribute must return a <span>CSS declaration block</span> with
27192719
the <span title=concept-css-declaration-block-readonly-flag>readonly flag</span> set and the
2720-
<span title=concept-css-declaration-block-declarations>declarations</span> set to all properties
2720+
<span title=concept-css-declaration-block-declarations>declarations</span> set to all longhand properties
27212721
the user agent supports with the value being the <span>computed value</span>
27222722
computed for the <span data-anolis-spec=dom>context object</span> using the style rules associated
27232723
with the <span data-anolis-spec=dom>context object</span>'s <span>associated document</span>.</p>
27242724

27252725
<p class=atrisk>The <dfn title=dom-GetStyleUtils-usedStyle><code>usedStyle</code></dfn> attribute must return a <span>CSS declaration block</span> with the
27262726
<span title=concept-css-declaration-block-readonly-flag>readonly flag</span> set and the
2727-
<span title=concept-css-declaration-block-declarations>declarations</span> set to all properties
2727+
<span title=concept-css-declaration-block-declarations>declarations</span> set to all longhand properties
27282728
the user agent supports with the value being the <span>used value</span>
27292729
computed for the <span data-anolis-spec=dom>context object</span> using the style rules associated
27302730
with the <span data-anolis-spec=dom>context object</span>'s <span>associated document</span>.</p>

0 commit comments

Comments
 (0)