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
<p>The <dfnid="dom-cssstyledeclaration-getpropertyvalue" title="dom-CSSStyleDeclaration-getPropertyValue"><code>getPropertyValue(<var>property</var>)</code></dfn> method must run these steps:</p>
2211
2211
<ol>
2212
-
<!-- XXX handle shorthands better -->
2213
2212
<li><p>Let <var>property</var> be <var>property</var><aclass="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#converted-to-ascii-lowercase">converted to ASCII lowercase</a>.
2213
+
<li><p>If <var>property</var> is a shorthand property, then follow these substeps:
2214
+
<ol>
2215
+
<li><p>Let <var>list</var> be a new empty array.
2216
+
<li><p>For each longhand property <var>longhand</var> that <var>property</var> maps to, in canonical order, follow these substeps:
2217
+
<ol>
2218
+
<li><p>If <var>longhand</var> is a <aclass="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
2219
+
<ahref="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a>, let <var>declaration</var> be that declaration, or null otherwise.
2220
+
<li><p>If <var>declaration</var> is null, return the empty string and terminate these steps.
2221
+
<li><p>Append the <var>declaration</var> to <var>list</var>.
2222
+
</ol>
2223
+
<li><p>Return the <ahref="#serialize-a-css-value" title="serialize a CSS value">serialization</a> of <var>list</var> and terminate these steps.
2224
+
</ol>
2214
2225
<li><p>If <var>property</var> is a <aclass="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#case-sensitive">case-sensitive</a>
2215
2226
match for a property of a declaration in the
2216
-
<ahref="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a>, return the
2217
-
<ahref="#serialize-a-css-value" title="serialize a CSS value">serialization</a> of that declaration's
2218
-
value.
2227
+
<ahref="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a>, return the result of invoking
2228
+
<ahref="#serialize-a-css-value">serialize a CSS value</a> of that declaration and terminate these steps.
<!-- based on http://damowmow.com/playground/canon.txt -->
2425
2435
2426
-
<p>To <dfnid="serialize-a-css-value">serialize a CSS value</dfn> follow
2436
+
<p>To <dfnid="serialize-a-css-value">serialize a CSS value</dfn>of a declaration <var>declaration</var> or a list of longhand declarations <var>list</var>, follow
2427
2437
these rules:</p>
2428
2438
2429
-
<ul>
2430
-
<li><p><ahref="#serialize-a-css-component-value" title="Serialize a CSS component value">Serialize</a> any
2431
-
CSS component values in the value.</li>
2432
-
2433
-
<li><p>Where multiple CSS component values can appear in any order
2434
-
without changing the meaning of the value (typically represented by a
2435
-
double bar <codetitle="">||</code> in the value syntax), use the order as given
<p>Where CSS component values of the value can be omitted without
2442
-
changing the meaning of the value (e.g. initial values in shorthand
2443
-
properties), omit them. If this would remove all the values, then
2444
-
include the first allowed value.</p>
2445
-
2446
-
<divclass="example"><p>E.g. <codetitle="">margin: 20px 20px</code> becomes
2447
-
<codetitle="">margin: 20px</code>.</div>
2448
-
2449
-
<divclass="example"><p>E.g. the value <codetitle="">0</code> for the
2450
-
'border' property.</div>
2451
-
</li>
2452
-
2453
-
<li><p>If the value of a shorthand property is requested and it cannot be
2454
-
computed because the properties associated with the shorthand have values
2455
-
that cannot be represented by the shorthand the serialization is the
2456
-
empty string.</li>
2457
-
2458
-
<li><p>If a value has a <ahref="#whitespace">whitespace</a>-separated list of
2459
-
CSS component values,
2460
-
<ahref="#serialize-a-whitespace-separated-list" title="serialize a whitespace-separated list">serialize</a> the
2461
-
value as a whitespace-separated list.</li>
2462
-
2463
-
<li><p>If a value has a comma-separated list of
2464
-
CSS component values,
2465
-
<ahref="#serialize-a-comma-separated-list" title="serialize a comma-separated list">serialize</a> the
2466
-
value as a comma-separated list.</li>
2467
-
</ul>
2468
-
2439
+
<ol>
2440
+
<li><p>If this algorithm is invoked with a list <var>list</var>, follow these substeps:
2441
+
<ol>
2442
+
<li><p>Let <var>shorthand</var> be the shorthand property that exactly maps to all the longhand properties in <var>list</var>.
2443
+
<li><p>If <var>shorthand</var> cannot represent the values of <var>list</var> in its grammar, return the empty string and terminate these steps.
2444
+
<li><p>Let <var>trimmed list</var> be a new empty array.
2445
+
<li><p>For each declaration <var>declaration</var> in <var>list</var>, if <var>declaration</var>'s value is not the initial value, or if
2446
+
<var>declaration</var> is a required component of the <var>shorthand</var> property, append <var>declaration</var> to <var>trimmed list</var>.
2447
+
<li><p>If <var>trimmed list</var> is empty, append the value of the first item in <var>list</var> to <var>trimmed list</var>.
2448
+
<li><p>Let <var>values</var> be a new empty array.
2449
+
<li><p>For each declaration <var>declaration</var> in <var>trimmed list</var>, invoke <ahref="#serialize-a-css-value">serialize a CSS value</a> of <var>declaration</var>, and
2450
+
append the result to <var>values</var>.
2451
+
<li><p>Return the result of joining <var>values</var> as appropriate according to the grammar of <var>shorthand</var> and terminate these steps.
2452
+
</ol>
2453
+
<li><p>Let <var>values</var> be a new empty array.
2454
+
<li><p>Append the result of invoking <ahref="#serialize-a-css-component-value">serialize a CSS component value</a> of <var>declaration</var>'s value to <var>values</var>.
2455
+
<li><p>If the grammar of the property of <var>declaration</var> is defined to be whitespace-separated, return the result of invoking <ahref="#serialize-a-whitespace-separated-list">serialize a
2456
+
whitespace-separated list</a> of <var>values</var> and terminate these steps.
2457
+
<li><p>If the grammar of the property of <var>declaration</var> is defined to be comma-separated, return the result of invoking <ahref="#serialize-a-comma-separated-list">serialize a
2458
+
comma-separated list</a> of <var>values</var>.
2459
+
</ol>
2469
2460
2470
2461
<p>To
2471
2462
<dfnid="serialize-a-css-component-value">serialize a CSS component value</dfn>
<p>Where CSS component values of the value can be omitted without
2376
-
changing the meaning of the value (e.g. initial values in shorthand
2377
-
properties), omit them. If this would remove all the values, then
2378
-
include the first allowed value.</p>
2379
-
2380
-
<divclass="example"><p>E.g. <codetitle>margin: 20px 20px</code> becomes
2381
-
<codetitle>margin: 20px</code>.</div>
2382
-
2383
-
<divclass="example"><p>E.g. the value <codetitle>0</code> for the
2384
-
'border' property.</div>
2385
-
</li>
2386
-
2387
-
<li><p>If the value of a shorthand property is requested and it cannot be
2388
-
computed because the properties associated with the shorthand have values
2389
-
that cannot be represented by the shorthand the serialization is the
2390
-
empty string.</p></li>
2391
-
2392
-
<li><p>If a value has a <span>whitespace</span>-separated list of
2393
-
CSS component values,
2394
-
<spantitle="serialize a whitespace-separated list">serialize</span> the
2395
-
value as a whitespace-separated list.</p></li>
2396
-
2397
-
<li><p>If a value has a comma-separated list of
2398
-
CSS component values,
2399
-
<spantitle="serialize a comma-separated list">serialize</span> the
2400
-
value as a comma-separated list.</p></li>
2401
-
</ul>
2402
-
2361
+
<ol>
2362
+
<li><p>If this algorithm is invoked with a list <var>list</var>, follow these substeps:
2363
+
<ol>
2364
+
<li><p>Let <var>shorthand</var> be the shorthand property that exactly maps to all the longhand properties in <var>list</var>.
2365
+
<li><p>If <var>shorthand</var> cannot represent the values of <var>list</var> in its grammar, return the empty string and terminate these steps.
2366
+
<li><p>Let <var>trimmed list</var> be a new empty array.
2367
+
<li><p>For each declaration <var>declaration</var> in <var>list</var>, if <var>declaration</var>'s value is not the initial value, or if
2368
+
<var>declaration</var> is a required component of the <var>shorthand</var> property, append <var>declaration</var> to <var>trimmed list</var>.
2369
+
<li><p>If <var>trimmed list</var> is empty, append the value of the first item in <var>list</var> to <var>trimmed list</var>.
2370
+
<li><p>Let <var>values</var> be a new empty array.
2371
+
<li><p>For each declaration <var>declaration</var> in <var>trimmed list</var>, invoke <span>serialize a CSS value</span> of <var>declaration</var>, and
2372
+
append the result to <var>values</var>.
2373
+
<li><p>Return the result of joining <var>values</var> as appropriate according to the grammar of <var>shorthand</var> and terminate these steps.
2374
+
</ol>
2375
+
<li><p>Let <var>values</var> be a new empty array.
2376
+
<li><p>Append the result of invoking <span>serialize a CSS component value</span> of <var>declaration</var>'s value to <var>values</var>.
2377
+
<li><p>If the grammar of the property of <var>declaration</var> is defined to be whitespace-separated, return the result of invoking <span>serialize a
2378
+
whitespace-separated list</span> of <var>values</var> and terminate these steps.
2379
+
<li><p>If the grammar of the property of <var>declaration</var> is defined to be comma-separated, return the result of invoking <span>serialize a
0 commit comments