Skip to content

Commit 4d8eca7

Browse files
author
Simon Pieters
committed
[cssom] Handle shorthands in removeProperty and getPropertyPriority. https://www.w3.org/Bugs/Public/show_bug.cgi?id=21765&list_id=17798
--HG-- extra : rebase_source : ed308d8f03da691a73723fe6a21ca0c2b5f9433f
1 parent 3f64f9e commit 4d8eca7

2 files changed

Lines changed: 66 additions & 30 deletions

File tree

cssom/Overview.html

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2204,6 +2204,7 @@ <h4 id="the-cssstyledeclaration-interface"><span class="secno">6.5.1 </span>The
22042204

22052205
<p>The <dfn id="dom-cssstyledeclaration-getpropertyvalue" title="dom-CSSStyleDeclaration-getPropertyValue"><code>getPropertyValue(<var>property</var>)</code></dfn> method must run these steps:</p>
22062206
<ol>
2207+
<!-- XXX handle shorthands better -->
22072208
<li><p>If <var>property</var> is an <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#ascii-case-insensitive">ASCII
22082209
case-insensitive</a> match for a property of a declaration in the
22092210
<a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a>, and that declaration's property
@@ -2221,15 +2222,26 @@ <h4 id="the-cssstyledeclaration-interface"><span class="secno">6.5.1 </span>The
22212222

22222223
<p>The <dfn id="dom-cssstyledeclaration-getpropertypriority" title="dom-CSSStyleDeclaration-getPropertyPriority"><code>getPropertyPriority(<var>property</var>)</code></dfn> method must run these steps:
22232224
<ol>
2224-
<li><p>If <var>property</var> is an <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#ascii-case-insensitive">ASCII
2225-
case-insensitive</a> match for a property of a declaration in the <a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a> that has the
2226-
<i>important</i> flag set, and that declaration's
2227-
property is defined to be case-insensitive, return the string "<code title="">important</code>".</p>
2228-
<li><p>If <var>property</var> is a
2229-
<a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#case-sensitive">case-sensitive</a> match for a property of a
2230-
declaration in the <a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a> that has the
2231-
<i>important</i> flag set, and that declaration's property is defined to be case-sensitive, return
2232-
the string "<code title="">important</code>".</p>
2225+
<li><p>If <var>property</var> is a shorthand property, follow these substeps:
2226+
<ol>
2227+
<li><p>Let <var>list</var> be a new array.
2228+
<li><p>For each longhand property <var>longhand</var> that <var>property</var> maps to, append the result of invoking
2229+
<code title="dom-CSSStyleDeclaration-getPropertyPriority"><a href="#dom-cssstyledeclaration-getpropertypriority">getPropertyPriority()</a></code> with <var>longhand</var> as argument to <var>list</var>.
2230+
<li><p>If all items in <var>list</var> are the string "<code title="">important</code>", return the string "<code title="">important</code>" and terminate these
2231+
steps.
2232+
</ol>
2233+
<li><p>Otherwise, follow these substeps:
2234+
<ol>
2235+
<li><p>If <var>property</var> is an <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#ascii-case-insensitive">ASCII
2236+
case-insensitive</a> match for a property of a declaration in the <a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a> that has the
2237+
<i>important</i> flag set, and that declaration's
2238+
property is defined to be case-insensitive, return the string "<code title="">important</code>".</p>
2239+
<li><p>If <var>property</var> is a
2240+
<a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#case-sensitive">case-sensitive</a> match for a property of a
2241+
declaration in the <a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a> that has the
2242+
<i>important</i> flag set, and that declaration's property is defined to be case-sensitive, return
2243+
the string "<code title="">important</code>".</p>
2244+
</ol>
22332245
<li><p>Return the empty string.
22342246
</ol>
22352247
<div class="example"><p>E.g. for <code title="">background-color:lime !IMPORTANT</code> the return
@@ -2238,6 +2250,7 @@ <h4 id="the-cssstyledeclaration-interface"><span class="secno">6.5.1 </span>The
22382250
<p>The <dfn id="dom-cssstyledeclaration-setproperty" title="dom-CSSStyleDeclaration-setProperty"><code>setProperty(<var>property</var>, <var>value</var>,
22392251
<var>priority</var>)</code></dfn> method must run these steps:</p>
22402252
<ol>
2253+
<!-- XXX handle shorthands better -->
22412254
<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>
22422255
an <code class="external" data-anolis-spec="dom"><a href="http://dom.spec.whatwg.org/#nomodificationallowederror">NoModificationAllowedError</a></code> exception and terminate these steps.</li>
22432256
<li><p>If <var>property</var> is not an <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#ascii-case-insensitive">ASCII case-insensitive</a> match for a supported property that is defined to be
@@ -2261,12 +2274,17 @@ <h4 id="the-cssstyledeclaration-interface"><span class="secno">6.5.1 </span>The
22612274
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>
22622275
<li><p>Let <var>value</var> be the return value of invoking <code title="dom-CSSStyleDeclaration-getPropertyValue"><a href="#dom-cssstyledeclaration-getpropertyvalue">getPropertyValue()</a></code>
22632276
with <var>property</var> as argument.
2264-
<li><p>If <var>property</var> is an <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#ascii-case-insensitive">ASCII case-insensitive</a> match for a property of a declaration in the
2265-
<a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a>, and that property is defined to be a case-insensitive property, remove the
2266-
declaration.</li>
2267-
<li><p>If <var>property</var> is a <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#case-sensitive">case-sensitive</a> match for a property of a declaration in the
2268-
<a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a>, and that property is defined to be a case-sensitive property, remove the
2269-
declaration.</li>
2277+
<li><p>If <var>property</var> is a shorthand property, for each longhand property <var>longhand</var> that <var>property</var> maps to, invoke
2278+
<code title="dom-CSSStyleDeclaration-removeProperty"><a href="#dom-cssstyledeclaration-removeproperty">removeProperty()</a></code> with <var>longhand</var> as argument.
2279+
<li><p>Otherwise, run these substeps:
2280+
<ol>
2281+
<li><p>If <var>property</var> is an <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#ascii-case-insensitive">ASCII case-insensitive</a> match for a property of a declaration in the
2282+
<a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a>, and that property is defined to be a case-insensitive property, remove the
2283+
declaration.</li>
2284+
<li><p>If <var>property</var> is a <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#case-sensitive">case-sensitive</a> match for a property of a declaration in the
2285+
<a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a>, and that property is defined to be a case-sensitive property, remove the
2286+
declaration.</li>
2287+
</ol>
22702288
<li><p>Return <var>value</var>.
22712289
</ol>
22722290

cssom/Overview.src.html

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2126,6 +2126,7 @@ <h4>The <code title>CSSStyleDeclaration</code> Interface</h4>
21262126

21272127
<p>The <dfn title=dom-CSSStyleDeclaration-getPropertyValue><code>getPropertyValue(<var>property</var>)</code></dfn> method must run these steps:</p>
21282128
<ol>
2129+
<!-- XXX handle shorthands better -->
21292130
<li><p>If <var>property</var> is an <span data-anolis-spec=dom>ASCII
21302131
case-insensitive</span> match for a property of a declaration in the
21312132
<span title=concept-css-declaration-block-declarations>declarations</span>, and that declaration's property
@@ -2143,15 +2144,26 @@ <h4>The <code title>CSSStyleDeclaration</code> Interface</h4>
21432144

21442145
<p>The <dfn title=dom-CSSStyleDeclaration-getPropertyPriority><code>getPropertyPriority(<var>property</var>)</code></dfn> method must run these steps:
21452146
<ol>
2146-
<li><p>If <var>property</var> is an <span data-anolis-spec=dom>ASCII
2147-
case-insensitive</span> match for a property of a declaration in the <span title=concept-css-declaration-block-declarations>declarations</span> that has the
2148-
<i>important</i> flag set, and that declaration's
2149-
property is defined to be case-insensitive, return the string "<code title>important</code>".</p>
2150-
<li><p>If <var>property</var> is a
2151-
<span data-anolis-spec=dom>case-sensitive</span> match for a property of a
2152-
declaration in the <span title=concept-css-declaration-block-declarations>declarations</span> that has the
2153-
<i>important</i> flag set, and that declaration's property is defined to be case-sensitive, return
2154-
the string "<code title>important</code>".</p>
2147+
<li><p>If <var>property</var> is a shorthand property, follow these substeps:
2148+
<ol>
2149+
<li><p>Let <var>list</var> be a new array.
2150+
<li><p>For each longhand property <var>longhand</var> that <var>property</var> maps to, append the result of invoking
2151+
<code title=dom-CSSStyleDeclaration-getPropertyPriority>getPropertyPriority()</code> with <var>longhand</var> as argument to <var>list</var>.
2152+
<li><p>If all items in <var>list</var> are the string "<code title>important</code>", return the string "<code title>important</code>" and terminate these
2153+
steps.
2154+
</ol>
2155+
<li><p>Otherwise, follow these substeps:
2156+
<ol>
2157+
<li><p>If <var>property</var> is an <span data-anolis-spec=dom>ASCII
2158+
case-insensitive</span> match for a property of a declaration in the <span title=concept-css-declaration-block-declarations>declarations</span> that has the
2159+
<i>important</i> flag set, and that declaration's
2160+
property is defined to be case-insensitive, return the string "<code title>important</code>".</p>
2161+
<li><p>If <var>property</var> is a
2162+
<span data-anolis-spec=dom>case-sensitive</span> match for a property of a
2163+
declaration in the <span title=concept-css-declaration-block-declarations>declarations</span> that has the
2164+
<i>important</i> flag set, and that declaration's property is defined to be case-sensitive, return
2165+
the string "<code title>important</code>".</p>
2166+
</ol>
21552167
<li><p>Return the empty string.
21562168
</ol>
21572169
<div class='example'><p>E.g. for <code title>background-color:lime !IMPORTANT</code> the return
@@ -2160,6 +2172,7 @@ <h4>The <code title>CSSStyleDeclaration</code> Interface</h4>
21602172
<p>The <dfn title=dom-CSSStyleDeclaration-setProperty><code>setProperty(<var>property</var>, <var>value</var>,
21612173
<var>priority</var>)</code></dfn> method must run these steps:</p>
21622174
<ol>
2175+
<!-- XXX handle shorthands better -->
21632176
<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>
21642177
an <code data-anolis-spec=dom>NoModificationAllowedError</code> exception and terminate these steps.</li>
21652178
<li><p>If <var>property</var> is not an <span data-anolis-spec=dom>ASCII case-insensitive</span> match for a supported property that is defined to be
@@ -2183,12 +2196,17 @@ <h4>The <code title>CSSStyleDeclaration</code> Interface</h4>
21832196
a <code data-anolis-spec=dom>NoModificationAllowedError</code> exception and terminate these steps.</li>
21842197
<li><p>Let <var>value</var> be the return value of invoking <code title='dom-CSSStyleDeclaration-getPropertyValue'>getPropertyValue()</code>
21852198
with <var>property</var> as argument.
2186-
<li><p>If <var>property</var> is an <span data-anolis-spec=dom>ASCII case-insensitive</span> match for a property of a declaration in the
2187-
<span title=concept-css-declaration-block-declarations>declarations</span>, and that property is defined to be a case-insensitive property, remove the
2188-
declaration.</p></li>
2189-
<li><p>If <var>property</var> is a <span data-anolis-spec=dom>case-sensitive</span> match for a property of a declaration in the
2190-
<span title=concept-css-declaration-block-declarations>declarations</span>, and that property is defined to be a case-sensitive property, remove the
2191-
declaration.</p></li>
2199+
<li><p>If <var>property</var> is a shorthand property, for each longhand property <var>longhand</var> that <var>property</var> maps to, invoke
2200+
<code title=dom-CSSStyleDeclaration-removeProperty>removeProperty()</code> with <var>longhand</var> as argument.
2201+
<li><p>Otherwise, run these substeps:
2202+
<ol>
2203+
<li><p>If <var>property</var> is an <span data-anolis-spec=dom>ASCII case-insensitive</span> match for a property of a declaration in the
2204+
<span title=concept-css-declaration-block-declarations>declarations</span>, and that property is defined to be a case-insensitive property, remove the
2205+
declaration.</p></li>
2206+
<li><p>If <var>property</var> is a <span data-anolis-spec=dom>case-sensitive</span> match for a property of a declaration in the
2207+
<span title=concept-css-declaration-block-declarations>declarations</span>, and that property is defined to be a case-sensitive property, remove the
2208+
declaration.</p></li>
2209+
</ol>
21922210
<li><p>Return <var>value</var>.
21932211
</ol>
21942212

0 commit comments

Comments
 (0)