8000 generalize NO_MODIFICATION_ALLOWED_ERR and define setProperty · w3c/csswg-drafts@8c74786 · GitHub
Skip to content

Commit 8c74786

Browse files
committed
generalize NO_MODIFICATION_ALLOWED_ERR and define setProperty
1 parent 70bcfe8 commit 8c74786

2 files changed

Lines changed: 126 additions & 34 deletions

File tree

cssom/Overview.html

Lines changed: 62 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,10 +1751,24 @@ <h4 id=the-cssstyledeclaration><span class=secno>3.6.1. </span>The <code><a
17511751
interface gives access to read and manipulate CSS properties and their
17521752
values within a declaration block.
17531753

1754+
<p>If an attribute or method returns an object implementing the <code><a
1755+
href="#cssstyledeclaration">CSSStyleDeclaration</a></code> interface (and
1756+
related interfaces) and says the object is <dfn id=readonly
1757+
title="readonly declaration">readonly</dfn> user agents <em
1758+
class=ct>must</em> raise a <code>NO_MODIFICATION_ALLOWED_ERR</code>
1759+
exception on an attempt to modify the object.
1760+
1761+
<p class=note>Invoking <code title=cssstyledeclaration-removeproperty><a
1762+
href="#cssstyledeclaration-removeproperty">removeProperty</a></code> or
1763+
setting <code title=cssstyledeclaration-csstext><a
1764+
href="#cssstyledeclaration-csstext">cssText</a></code> would be examples
1765+
of that.</p>
1766+
<!-- XXX Or do we need to specify this independently for each attribute and
1767+
method? -->
1768+
17541769
<p class 81AA =issue><code><a
1755-
href="#cssstyledeclaration">CSSStyleDeclaration</a></code> comes in
1756-
several forms. It can represent computed values and used values. It can
1757-
also be readonly depending on the accessor. (This also goes for interfaces
1770+
href="#cssstyledeclaration">CSSStyleDeclaration</a></code> can represent
1771+
computed values and used values. (This also goes for interfaces
17581772
implemented on top of <code><a
17591773
href="#cssstyledeclaration">CSSStyleDeclaration</a></code> objects
17601774
obviously.)
@@ -1763,10 +1777,10 @@ <h4 id=the-cssstyledeclaration><span class=secno>3.6.1. </span>The <code><a
17631777
class=idl>interface <dfn id=cssstyledeclaration>CSSStyleDeclaration</dfn> {
17641778
attribute DOMString <a href="#cssstyledeclaration-csstext" title=cssstyledeclaration-csstext>cssText</a>;
17651779
DOMString <a href="#cssstyledeclaration-getpropertyvalue" title=cssstyledeclaration-getpropertyvalue>getPropertyValue</a>(in DOMString <var title="">property</var>);
1766-
DOMString <a href="#cssstyledeclaration-removeproperty" title=cssstyledeclaration-removeproperty>removeProperty</a>(in DOMString <var title="">property</var>);
17671780
DOMString <span title=cssstyledeclaration-getpropertypriority>getPropertyPriority</span>(in DOMString <var title="">property</var>);
1768-
void <span title=cssstyledeclaration-setproperty>setProperty</span>(in DOMString <var title="">property</var>, in DOMString <var title="">value</var>);
1769-
void <span title=cssstyledeclaration-setproperty>setProperty</span>(in DOMString <var title="">property</var>, in DOMString <var title="">value</var>, in DOMString <var title="">priority</var>);
1781+
DOMString <a href="#cssstyledeclaration-removeproperty" title=cssstyledeclaration-removeproperty>removeProperty</a>(in DOMString <var title="">property</var>);
1782+
void <a href="#cssstyledeclaration-setproperty" title=cssstyledeclaration-setproperty>setProperty</a>(in DOMString <var title="">property</var>, in DOMString <var title="">value</var>);
1783+
void <a href="#cssstyledeclaration-setproperty" title=cssstyledeclaration-setproperty>setProperty</a>(in DOMString <var title="">property</var>, in DOMString <var title="">value</var>, in DOMString <var title="">priority</var>);
17701784
readonly attribute unsigned long <span title=cssstyledeclaration-length>length</span>;
17711785
DOMString <span title=cssstyledeclaration-item>item</span>(in unsigned long <var title="">index</var>);
17721786
readonly attribute <a href="#cssrule">CSSRule</a> <span title=cssstyledeclaration-parentrule>parentRule</span>;
@@ -1780,10 +1794,7 @@ <h4 id=the-cssstyledeclaration><span class=secno>3.6.1. </span>The <code><a
17801794
<code>DOMString</code>
17811795

17821796
<dd>
1783-
<p>On setting, user agents <em class=ct>must</em> raise a
1784-
<code>NO_MODIFICATION_ALLOWED_ERR</code> exception when the declaration
1785-
block is marked as <span title="declaration readonly">readonly</span>.
1786-
Otherwise, user agents <em class=ct>must</em> remove all properties
1797+
<p>On setting, user agents <em class=ct>must</em> remove all properties
17871798
currently set on the object and then parse the given string as the
17881799
contents of a declaration block and set each property / value pair that
17891800
is not ignored on the <code><a
@@ -1797,16 +1808,51 @@ <h4 id=the-cssstyledeclaration><span class=secno>3.6.1. </span>The <code><a
17971808

17981809
<dd>...
17991810

1811+
<dt>getPropertyPriority
1812+
1813+
<dd>
1814+
18001815
<dt><dfn id=cssstyledeclaration-removeproperty
18011816
title=cssstyledeclaration-removeproperty><code>removeProperty(<var
18021817
title="">property</var>)</code>, method</dfn>
18031818

1804-
<dd>When invoked, user agents <em class=ct>must</em> raise a
1805-
<code>NO_MODIFICATION_ALLOWED_ERR</code> exception when the declaration
1806-
block is marked as <span title="declaration readonly">readonly</span>.
1807-
Otherwise, if <var title="">property</var> case-insensitively matches a
1808-
specified property user agents <em class=ct>must</em> remove that
1809-
property declaration.
1819+
<dd>When invoked, if <var title="">property</var> case-insensitively
1820+
matches a specified property user agents <em class=ct>must</em> remove
1821+
that property declaration.
1822+
1823+
<dt><dfn id=cssstyledeclaration-setproperty
1824+
title=cssstyledeclaration-setproperty><code>setProperty(<var
1825+
title="">property</var>, <var title="">value</var>, <var
1826+
title="">priority</var>)</code>, method</dfn>
1827+
1828+
<dd>
1829+
<p>When invoked, user agents <em class=ct>must</em> follow the following
1830+
steps, in order:</p>
1831+
1832+
<ol>
1833+
<li>If <var title="">property</var> does not case-insensitively match a
1834+
supported property abort this algorithm.
1835+
1836+
<li>If <var title="">value</var> is <code>null</code> or the empty
1837+
string invoke <code title=cssstyledeclaration-removeproperty><a
1838+
href="#cssstyledeclaration-removeproperty">removeProperty</a></code>
1839+
with <var title="">property</var> as argument and abort this algorithm.
1840+
1841+
<li>If the <var title="">priority</var> argument has been omitted let
1842+
<var title="">priority</var> be <code>null</code>.
1843+
1844+
<li>If <var title="">priority</var> is neither a valid priority nor
1845+
<code>null</code> or the empty string abort this algorithm.
1846+
1847+
<li>If <var title="">value</var> cannot be parsed into a legal value
1848+
abort this algorithm.
1849+
1850+
<li>Finally, set <var title="">property</var> to <var
1851+
title="">value</var> with priority <var title="">priority</var> when
1852+
<var title="">priority</var> is not <code>null</code> or the empty
1853+
string. Otherwise set <var title="">property</var> to <var
1854+
title="">value</var>.
1855+
</ol>
18101856
</dl>
18111857

18121858
<h4 id=css-properties><span class=secno>3.6.2. </span>CSS Properties</h4>

cssom/Overview.src.html

Lines changed: 64 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,16 +1380,29 @@ <h4>The <code>CSSStyleDeclaration</code> Interface</h4>
13801380
<p>The <code>CSSStyleDeclaration</code> interface gives access to read and
13811381
manipulate CSS properties and their values within a declaration block.</p>
13821382

1383-
<p class="issue"><code>CSSStyleDeclaration</code> comes in several forms. It
1384-
can represent computed values and used values. It can also be readonly
1385-
depending on the accessor. (This also goes for interfaces implemented on top
1383+
<p>If an attribute or method returns an object implementing the
1384+
<code>CSSStyleDeclaration</code> interface (and related interfaces) and says
1385+
the object is <dfn title="readonly declaration">readonly</dfn> user agents
1386+
<em class="ct">must</em> raise a <code>NO_MODIFICATION_ALLOWED_ERR</code>
1387+
exception on an attempt to modify the object.</p>
1388+
1389+
<p class="note">Invoking
1390+
<code title="cssstyledeclaration-removeproperty">removeProperty</code> or
1391+
setting <code title="cssstyledeclaration-csstext">cssText</code> would be
1392+
examples of that.</p>
1393+
1394+
<!-- XXX Or do we need to specify this independently for each attribute and
1395+
method? -->
1396+
1397+
<p class="issue"><code>CSSStyleDeclaration</code> can represent computed
1398+
values and used values. (This also goes for interfaces implemented on top
13861399
of <code>CSSStyleDeclaration</code> objects obviously.)</p>
13871400

13881401
<pre class="idl">interface <dfn>CSSStyleDeclaration</dfn> {
13891402
attribute DOMString <span title="cssstyledeclaration-csstext">cssText</span>;
13901403
DOMString <span title="cssstyledeclaration-getpropertyvalue">getPropertyValue</span>(in DOMString <var title="">property</var>);
1391-
DOMString <span title="cssstyledeclaration-removeproperty">removeProperty</span>(in DOMString <var title="&quo 980 t;>property</var>);
13921404
DOMString <span title="cssstyledeclaration-getpropertypriority">getPropertyPriority</span>(in DOMString <var title="">property</var>);
1405+
DOMString <span title="cssstyledeclaration-removeproperty">removeProperty</span>(in DOMString <var title="">property</var>);
13931406
void <span title="cssstyledeclaration-setproperty">setProperty</span>(in DOMString <var title="">property</var>, in DOMString <var title="">value</var>);
13941407
void <span title="cssstyledeclaration-setproperty">setProperty</span>(in DOMString <var title="">property</var>, in DOMString <var title="">value</var>, in DOMString <var title="">priority</var>);
13951408
readonly attribute unsigned long <span title="cssstyledeclaration-length">length</span>;
@@ -1404,31 +1417,64 @@ <h4>The <code>CSSStyleDeclaration</code> Interface</h4>
14041417
of type <code>DOMString</code></dt>
14051418

14061419
<dd>
1407-
<p>On setting, user agents <em class="ct">must</em> raise a
1408-
<code>NO_MODIFICATION_ALLOWED_ERR</code> exception when the declaration
1409-
block is marked as <span title="declaration readonly">readonly</span>.
1410-
Otherwise, user agents <em class="ct">must</em> remove all properties
1420+
<p>On setting, user agents <em class="ct">must</em> remove all properties
14111421
currently set on the object and then parse the given string as the
14121422
contents of a declaration block and set each property / value pair that is
14131423
not ignored on the <code>CSSStyleDeclaration</code> block.</p>
14141424

14151425
<p>On getting, <span class="issue">...</span>.</p>
14161426
</dd>
1417-
1427+
14181428
<dt><dfn id="cssstyledeclaration-getpropertyvalue" title="cssstyledeclaration-getpropertyvalue"><code>getPropertyValue(<var title="">property</var>)</code>,
14191429
method</dfn></dt>
1420-
1430+
14211431
<dd>...</dd>
1422-
1432+
1433+
<dt>getPropertyPriority</dt>
1434+
<dd></dd>
1435+
14231436
<dt><dfn id="cssstyledeclaration-removeproperty" title="cssstyledeclaration-removeproperty"><code>removeProperty(<var title="">property</var>)</code>,
14241437
method</dfn></dt>
1425-
1426-
<dd>When invoked, user agents <em class="ct">must</em> raise a
1427-
<code>NO_MODIFICATION_ALLOWED_ERR</code> exception when the declaration
1428-
block is marked as <span title="declaration readonly">readonly</span>.
1429-
Otherwise, if <var title="">property</var> case-insensitively matches a
1430-
specified property user agents <em class="ct">must</em> remove that
1431-
property declaration.</dd>
1438+
1439+
<dd>When invoked, if <var title="">property</var> case-insensitively
1440+
matches a specified property user agents <em class="ct">must</em> remove
1441+
that property declaration.</dd>
1442+
1443+
1444+
<dt><dfn id="cssstyledeclaration-setproperty" title="cssstyledeclaration-setproperty"><code>setProperty(<var title="">property</var>,
1445+
<var title="">value</var>, <var title="">priority</var>)</code>,
1446+
method</dfn>
1447+
1448+
<dd>
1449+
<p>When invoked, user agents <em class="ct">must</em> follow the following
1450+
steps, in order:</p>
1451+
1452+
<ol>
1453+
<li>If <var title="">property</var> does not case-insensitively match a
1454+
supported property abort this algorithm.</li>
1455+
1456+
<li>If <var title="">value</var> is <code>null</code> or the empty string
1457+
invoke
1458+
<code title="cssstyledeclaration-removeproperty">removeProperty</code>
1459+
with <var title="">property</var> as argument and abort this
1460+
algorithm.</li>
1461+
1462+
<li>If the <var title="">priority</var> argument has been omitted let
1463+
<var title="">priority</var> be <code>null</code>.</li>
1464+
1465+
<li>If <var title="">priority</var> is neither a valid priority nor
1466+
<code>null</code> or the empty string abort this algorithm.</li>
1467+
1468+
<li>If <var title="">value</var> cannot be parsed into a legal value
1469+
abort this algorithm.</li>
1470+
1471+
<li>Finally, set <var title="">property</var> to
1472+
<var title="">value</var> with priority <var title="">priority</var> when
1473+
<var title="">priority</var> is not <code>null</code> or the empty
1474+
string. Otherwise set <var title="">property</var> to
1475+
<var title="">value</var>.</li>
1476+
</ol>
1477+
</dd>
14321478
</dl>
14331479

14341480
<h4>CSS Properties</h4>

0 commit comments

Comments
 (0)