|
16 | 16 | <h1>CSS Object Model (CSSOM)</h1>
|
17 | 17 |
|
18 | 18 |
|
19 |
| - <h2 class="no-num no-toc" id="w3c-doctype">Editor's Draft 5 September 2013</h2> |
| 19 | + <h2 class="no-num no-toc" id="w3c-doctype">Editor's Draft 11 September 2013</h2> |
20 | 20 |
|
21 | 21 | <dl>
|
22 | 22 |
|
@@ -90,7 +90,7 @@ <h2 class="no-num no-toc" id="sotd">Status of This Document</h2>
|
90 | 90 | can be found in the
|
91 | 91 | <a href="http://www.w3.org/TR/">W3C technical reports index at http://www.w3.org/TR/.</a></em>
|
92 | 92 |
|
93 |
| -<p class="dontpublish">This is the 5 September 2013 Editor's Draft of CSSOM. Please send comments to |
| 93 | +<p class="dontpublish">This is the 11 September 2013 Editor's Draft of CSSOM. Please send comments to |
94 | 94 | <a href="mailto:www-style@w3.org?subject=%5Bcssom%5D%20">www-style@w3.org</a>
|
95 | 95 | (<a href="http://lists.w3.org/Archives/Public/www-style/">archived</a>)
|
96 | 96 | with <samp>[cssom]</samp> at the start of the subject line.
|
@@ -2256,7 +2256,7 @@ <h3 id="css-declaration-blocks"><span class="secno">6.6 </span>CSS Declaration B
|
2256 | 2256 | <li><p>If <var>property</var> maps to one or more shorthand properties, let <var>shorthands</var> be an array of those shorthand properties, in
|
2257 | 2257 | <a href="#concept-shorthands-preferred-order" title="concept-shorthands-preferred-order">preferred order</a>, and follow these substeps:
|
2258 | 2258 | <ol>
|
2259 |
| - <li><p>Let <var>longhands</var> an array consisting of all <a href="#css-declaration" title="CSS declaration">CSS declarations</a> in <var>declaration block</var>'s |
| 2259 | + <li><p>Let <var>longhands</var> be an array consisting of all <a href="#css-declaration" title="CSS declaration">CSS declarations</a> in <var>declaration block</var>'s |
2260 | 2260 | <a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a> that that are not in <var>already serialized</var> and have a
|
2261 | 2261 | <a href="#concept-css-declaration-property-name" title="concept-css-declaration-property-name">property name</a> that
|
2262 | 2262 | maps to one of the shorthand properties in <var>shorthands</var>.
|
@@ -2327,7 +2327,9 @@ <h4 id="the-cssstyledeclaration-interface"><span class="secno">6.6.1 </span>The
|
2327 | 2327 | DOMString <a href="#dom-cssstyledeclaration-getpropertyvalue" title="dom-CSSStyleDeclaration-getPropertyValue">getPropertyValue</a>(DOMString property);
|
2328 | 2328 | DOMString <a href="#dom-cssstyledeclaration-getpropertypriority" title="dom-CSSStyleDeclaration-getPropertyPriority">getPropertyPriority</a>(DOMString property);
|
2329 | 2329 | void <a href="#dom-cssstyledeclaration-setproperty" title="dom-CSSStyleDeclaration-setProperty">setProperty</a>(DOMString property, [TreatNullAs=EmptyString] DOMString value, <!--
|
2330 |
| - -->[TreatNullAs=EmptyString] optional DOMString priority); |
| 2330 | + -->[TreatNullAs=EmptyString] optional DOMString priority = ""); |
| 2331 | + void <a href="#dom-cssstyledeclaration-setpropertyvalue" title="dom-CSSStyleDeclaration-setPropertyValue">setPropertyValue</a>(DOMString property, [TreatNullAs=EmptyString] DOMString value); |
| 2332 | + void <a href="#dom-cssstyledeclaration-setpropertypriority" title="dom-CSSStyleDeclaration-setPropertyPriority">setPropertyPriority</a>(DOMString property, [TreatNullAs=EmptyString] DOMString priority); |
2331 | 2333 | DOMString <a href="#dom-cssstyledeclaration-removeproperty" title="dom-CSSStyleDeclaration-removeProperty">removeProperty</a>(DOMString property);
|
2332 | 2334 | readonly attribute <a href="#cssrule">CSSRule</a>? <a href="#dom-cssstyledeclaration-parentrule" title="dom-CSSStyleDeclaration-parentRule">parentRule</a>;
|
2333 | 2335 | attribute DOMString <a href="#dom-cssstyledeclaration-cssfloat" title="dom-CSSStyleDeclaration-cssFloat">cssFloat</a>;<!-- setProperty's value arg has [TreatNullAs=EmptyString] -->
|
@@ -2411,35 +2413,97 @@ <h4 id="the-cssstyledeclaration-interface"><span class="secno">6.6.1 </span>The
|
2411 | 2413 | algorithm.</li>
|
2412 | 2414 | <li><p>If <var>value</var> is the empty string, invoke <code title="dom-CSSStyleDeclaration-removeProperty"><a href="#dom-cssstyledeclaration-removeproperty">removeProperty()</a></code>
|
2413 | 2415 | with <var>property</var> as argument and terminate this algorithm.</li>
|
2414 |
| - <li><p>If <var>priority</var> is not specified, let <var>priority action</var> be "leave as is". Otherwise, if <var>priority</var> is the empty string, let |
2415 |
| - <var>priority action</var> be "unset important". Otherwise, if <var>priority</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 the |
2416 |
| - string "<code title="">important</code>", set <var>priority action</var> to "set important". Otherwise, terminate this algorithm. |
| 2416 | + <li><p>If <var>priority</var> is not the empty string and 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 the string |
| 2417 | + "<code title="">important</code>", terminate this algorithm. |
2417 | 2418 | <li>
|
2418 | 2419 | <p>Let <var>component value list</var> be the result of <a href="#parse-a-css-value" title="parse a CSS value">parsing</a> <var>value</var>.
|
2419 | 2420 | <p class="note"><var>value</var> can not include "<code title="">!important</code>".</p>
|
2420 | 2421 | </li>
|
2421 | 2422 | <li><p>If <var>component value list</var> is null terminate these steps.
|
2422 | 2423 | <li><p>If <var>property</var> is a shorthand property, then for each longhand property <var>longhand</var> that <var>property</var> maps to, in canonical
|
2423 |
| - order, <a href="#set-a-css-property" title="set a CSS property">set the CSS property</a> <var>longhand</var> to the appropriate value(s) from <var>component value list</var>, with |
2424 |
| - <i>priority action</i> being <var>priority action</var>, and with the list of declarations being the |
| 2424 | + order, <a href="#append-a-css-declaration" title="append a CSS declaration">append the CSS declaration</a> <var>longhand</var> with the appropriate value(s) from <var>component value |
| 2425 | + list</var>, with the <i>important</i> flag set if <var>priority</var> is not the empty string, and unset otherwise, and with the list of declarations being the |
2425 | 2426 | <a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a>.
|
2426 |
| - <li><p>Otherwise, <a href="#set-a-css-property" title="set a CSS property">set the CSS property</a> <var>property</var> to <var>component value list</var>, with |
2427 |
| - <i>priority action</i> being <var>priority action</var>, and with the list of declarations being the |
| 2427 | + <li><p>Otherwise, <a href="#append-a-css-declaration" title="append a CSS declaration">append the CSS declaration</a> <var>property</var> with value <var>component value list</var>, with |
| 2428 | + the <i>important</i> flag set if <var>priority</var> is not the empty string, and unset otherwise, and with the list of declarations being the |
2428 | 2429 | <a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a>.
|
2429 | 2430 | </ol>
|
2430 | 2431 |
|
2431 |
| -<p>To <dfn id="set-a-css-property">set a CSS property</dfn> <var>property</var> to a value <var>component value list</var> and with <i>priority action</i> being either "set |
2432 |
| -important", "unset important" or "leave as is", in a list of declarations <var>declarations</var>, follow these steps: |
| 2432 | +<p>To <dfn id="append-a-css-declaration">append a CSS declaration</dfn> <var>property</var> with a value <var>component value list</var> and optionally with an <i>important</i> flag set, in |
| 2433 | +a list of declarations <var>declarations</var>, follow these steps: |
2433 | 2434 |
|
2434 | 2435 | <ol>
|
2435 | 2436 | <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 <a href="#concept-css-declaration-property-name" title="concept-css-declaration-property-name">property
|
2436 | 2437 | name</a> of a <a href="#css-declaration">CSS declaration</a> in <var>declarations</var>, let <var>declaration</var> be that <a href="#css-declaration">CSS declaration</a>.
|
2437 | 2438 | <li><p>Otherwise, append a new <a href="#css-declaration">CSS declaration</a> with the <a href="#concept-css-declaration-property-name" title="concept-css-declaration-property-name">property name</a> <var>property</var>
|
2438 | 2439 | to <var>declarations</var> and let <var>declaration</var> be that <a href="#css-declaration">CSS declaration</a>.
|
| 2440 | + <li><p>If <var>declaration</var> has its <a href="#concept-css-declaration-important-flag" title="concept-css-declaration-important-flag">important flag</a> set and the <i>important</i> flag is not set, |
| 2441 | + terminate these steps. |
2439 | 2442 | <li><p>Set <var>declaration</var>'s <a href="#concept-css-declaration-value" title="concept-css-declaration-value">value</a> to <var>component value list</var>.
|
2440 |
| - <li><p>If <i>priority action</i> is "set important", set <var>declaration</var>'s <a href="#concept-css-declaration-important-flag" title="concept-css-declaration-important-flag">important flag</a>. |
2441 |
| - <li><p>Otherwise, if <i>priority action</i> is "unset important", unset <var>declaration</var>'s <a href="#concept-css-declaration-important-flag" title="concept-css-declaration-important-flag">important |
2442 |
| - flag</a>. |
| 2443 | + <li><p>If the <i>important</i> flag is set, set <var>declaration</var>'s <a href="#concept-css-declaration-important-flag" title="concept-css-declaration-important-flag">important flag</a>. |
| 2444 | +</ol> |
| 2445 | + |
| 2446 | +<p>The <dfn id="dom-cssstyledeclaration-setpropertyvalue" title="dom-CSSStyleDeclaration-setPropertyValue"><code>setPropertyValue(<var>property</var>, <var>value</var>)</code></dfn> method must run these |
| 2447 | +steps:</p> |
| 2448 | +<ol> |
| 2449 | + <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> |
| 2450 | + 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> |
| 2451 | + <li><p>Let <var>property</var> be <var>property</var> <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#converted-to-ascii-lowercase">converted to ASCII lowercase</a>. |
| 2452 | + <li><p>If <var>property</var> is not a <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#case-sensitive">case-sensitive</a> match for a <a href="#supported-css-property">supported CSS property</a>, terminate this |
| 2453 | + algorithm.</li> |
| 2454 | + <li><p>If <var>value</var> is the empty string, invoke <code title="dom-CSSStyleDeclaration-removeProperty"><a href="#dom-cssstyledeclaration-removeproperty">removeProperty()</a></code> |
| 2455 | + with <var>property</var> as argument and terminate this algorithm.</li> |
| 2456 | + <li> |
| 2457 | + <p>Let <var>component value list</var> be the result of <a href="#parse-a-css-value" title="parse a CSS value">parsing</a> <var>value</var>. |
| 2458 | + <p class="note"><var>value</var> can not include "<code title="">!important</code>".</p> |
| 2459 | + </li> |
| 2460 | + <li><p>If <var>component value list</var> is null terminate these steps. |
| 2461 | + <li><p>If <var>property</var> is a shorthand property, then for each longhand property <var>longhand</var> that <var>property</var> maps to, in canonical |
| 2462 | + order, <a href="#set-a-css-declaration-value" title="set a CSS declaration value">set the CSS declaration value</a> <var>longhand</var> to the appropriate value(s) from <var>component |
| 2463 | + value list</var>, and with the list of declarations being the <a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a>. |
| 2464 | + <li><p>Otherwise, <a href="#set-a-css-declaration-value" title="set a CSS declaration value">set the CSS declaration value</a> <var>property</var> to the value <var>component value |
| 2465 | + list</var>, and with the list of declarations being the <a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a>. |
| 2466 | +</ol> |
| 2467 | + |
| 2468 | +<p>To <dfn id="set-a-css-declaration-value">set a CSS declaration value</dfn> to a value <var>component value list</var> in a list of declarations <var>declarations</var>, follow these steps: |
| 2469 | + |
| 2470 | +<ol> |
| 2471 | + <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 <a href="#concept-css-declaration-property-name" title="concept-css-declaration-property-name">property |
| 2472 | + name</a> of a <a href="#css-declaration">CSS declaration</a> in <var>declarations</var>, let <var>declaration</var> be that <a href="#css-declaration">CSS declaration</a>. |
| 2473 | + <li><p>Otherwise, append a new <a href="#css-declaration">CSS declaration</a> with the <a href="#concept-css-declaration-property-name" title="concept-css-declaration-property-name">property name</a> <var>property</var> |
| 2474 | + to <var>declarations</var> and let <var>declaration</var> be that <a href="#css-declaration">CSS declaration</a>. |
| 2475 | + <li><p>Set <var>declaration</var>'s <a href="#concept-css-declaration-value" title="concept-css-declaration-value">value</a> to <var>component value list</var>. |
| 2476 | +</ol> |
| 2477 | + |
| 2478 | +<p>The <dfn id="dom-cssstyledeclaration-setpropertypriority" title="dom-CSSStyleDeclaration-setPropertyPriority"><code>setPropertyPriority(<var>property</var>, <var>priority</var>)</code></dfn> method must run |
| 2479 | +these steps:</p> |
| 2480 | + |
| 2481 | +<ol> |
| 2482 | + <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> |
| 2483 | + 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> |
| 2484 | + <li><p>Let <var>property</var> be <var>property</var> <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#converted-to-ascii-lowercase">converted to ASCII lowercase</a>. |
| 2485 | + <li><p>If <var>property</var> is not a <a class="external" data-anolis-spec="dom" href="http://dom.spec.whatwg.org/#case-sensitive">case-sensitive</a> match for a <a href="#supported-css-property">supported CSS property</a>, terminate this |
| 2486 | + algorithm.</li> |
| 2487 | + <li><p>If <var>priority</var> is not the empty string and 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 the string |
| 2488 | + "<code title="">important</code>", terminate this algorithm. |
| 2489 | + <li><p>If <var>property</var> is a shorthand property, then for each longhand property <var>longhand</var> that <var>property</var> maps to, in canonical |
| 2490 | + order, <a href="#set-a-css-declaration-priority" title="set a CSS declaration priority">set the CSS declaration priority</a> <var>longhand</var> with the <i>important</i> flag set if |
| 2491 | + <var>priority</var> is not the empty string, and unset otherwise, and with the list of declarations being the |
| 2492 | + <a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a>. |
| 2493 | + <li><p>Otherwise, <a href="#set-a-css-declaration-priority" title="set a CSS declaration priority">set the CSS declaration priority</a> <var>property</var> with the <i>important</i> flag set |
| 2494 | + if <var>priority</var> is not the empty string, and unset otherwise, and with the list of declarations being the |
| 2495 | + <a href="#concept-css-declaration-block-declarations" title="concept-css-declaration-block-declarations">declarations</a>. |
| 2496 | +</ol> |
| 2497 | + |
| 2498 | +<p>To <dfn id="set-a-css-declaration-priority">set a CSS declaration priority</dfn> <var>property</var> optionally with an <i>important</i> flag set, in a list of declarations |
| 2499 | +<var>declarations</var>, follow these steps: |
| 2500 | + |
| 2501 | +<ol> |
| 2502 | + <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 <a href="#concept-css-declaration-property-name" title="concept-css-declaration-property-name">property |
| 2503 | + name</a> of a <a href="#css-declaration">CSS declaration</a> in <var>declarations</var>, let <var>declaration</var> be that <a href="#css-declaration">CSS declaration</a>. |
| 2504 | + <li><p>Otherwise, terminate these steps. |
| 2505 | + <li><p>If the <i>important</i> flag is set, set <var>declaration</var>'s <a href="#concept-css-declaration-important-flag" title="concept-css-declaration-important-flag">important flag</a>. Otherwise, |
| 2506 | + unset <var>declaration</var>'s <a href="#concept-css-declaration-important-flag" title="concept-css-declaration-important-flag">important flag</a>. |
2443 | 2507 | </ol>
|
2444 | 2508 |
|
2445 | 2509 | <p>The <dfn id="dom-cssstyledeclaration-removeproperty" title="dom-CSSStyleDeclaration-removeProperty"><code>removeProperty(<var>property</var>)</code></dfn> method must run these steps:</p>
|
|
0 commit comments