Skip to content

Commit 7083116

Browse files
upsuperSimonSapin
authored andcommitted
[cssom] Handle custom properties separately.
Fixes #630.
1 parent d1012ee commit 7083116

File tree

1 file changed

+45
-34
lines changed

1 file changed

+45
-34
lines changed

cssom/Overview.bs

Lines changed: 45 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ spec:dom; type:interface; text:Document
108108
spec:html; type:dfn; text:ascii case-insensitive
109109
spec:html; type:dfn; text:case-sensitive
110110
spec:css-logical-props-1; type:property; text:inline-size
111+
spec:css-variables-1; type:dfn; text:custom property
111112
</pre>
112113

113114
<script src=https://resources.whatwg.org/file-issue.js defer data-file-issue-url="https://github.com/w3c/csswg-drafts/issues/new?title=%5Bcssom%5D%20"></script>
@@ -1964,19 +1965,22 @@ The <dfn method for=CSSStyleDeclaration>item(<var>index</var>)</dfn> method must
19641965

19651966
The <dfn method for=CSSStyleDeclaration>getPropertyValue(<var>property</var>)</dfn> method must run these steps:
19661967
<ol>
1967-
<li>Let <var>property</var> be <var>property</var> <a>converted to ASCII lowercase</a>.
1968-
<li>If <var>property</var> is a shorthand property, then follow these substeps:
1968+
<li>If <var>property</var> is not a <a>custom property</a>, follow these substeps:
19691969
<ol>
1970-
<li>Let <var>list</var> be a new empty array.
1971-
<li>For each longhand property <var>longhand</var> that <var>property</var> maps to, in canonical order, follow these substeps:
1970+
<li>Let <var>property</var> be <var>property</var> <a>converted to ASCII lowercase</a>.
1971+
<li>If <var>property</var> is a shorthand property, then follow these substeps:
19721972
<ol>
1973-
<li>If <var>longhand</var> is a <a>case-sensitive</a> match for a <a for="CSS declaration">property
1974-
name</a> of a <a>CSS declaration</a> in the <a for="CSSStyleDeclaration">declarations</a>, let <var>declaration</var>
1975-
be that <a>CSS declaration</a>, or null otherwise.
1976-
<li>If <var>declaration</var> is null, return the empty string and terminate these steps.
1977-
<li>Append the <var>declaration</var> to <var>list</var>.
1973+
<li>Let <var>list</var> be a new empty array.
1974+
<li>For each longhand property <var>longhand</var> that <var>property</var> maps to, in canonical order, follow these substeps:
1975+
<ol>
1976+
<li>If <var>longhand</var> is a <a>case-sensitive</a> match for a <a for="CSS declaration">property
1977+
name</a> of a <a>CSS declaration</a> in the <a for="CSSStyleDeclaration">declarations</a>, let <var>declaration</var>
1978+
be that <a>CSS declaration</a>, or null otherwise.
1979+
<li>If <var>declaration</var> is null, return the empty string and terminate these steps.
1980+
<li>Append the <var>declaration</var> to <var>list</var>.
1981+
</ol>
1982+
<li>Return the <a lt="serialize a CSS value">serialization</a> of <var>list</var> and terminate these steps.
19781983
</ol>
1979-
<li>Return the <a lt="serialize a CSS value">serialization</a> of <var>list</var> and terminate these steps.
19801984
</ol>
19811985
<li>If <var>property</var> is a <a>case-sensitive</a>
19821986
match for a <a for="CSS declaration">property name</a> of a <a>CSS declaration</a> in the
@@ -1987,22 +1991,22 @@ The <dfn method for=CSSStyleDeclaration>getPropertyValue(<var>property</var>)</d
19871991

19881992
The <dfn method for=CSSStyleDeclaration>getPropertyPriority(<var>property</var>)</dfn> method must run these steps:
19891993
<ol>
1990-
<li>Let <var>property</var> be <var>property</var> <a>converted to ASCII lowercase</a>.
1991-
<li>If <var>property</var> is a shorthand property, follow these substeps:
1992-
<ol>
1993-
<li>Let <var>list</var> be a new array.
1994-
<li>For each longhand property <var>longhand</var> that <var>property</var> maps to, append the result of invoking
1995-
{{CSSStyleDeclaration/getPropertyPriority()}} with <var>longhand</var> as argument to <var>list</var>.
1996-
<li>If all items in <var>list</var> are the string "<code>important</code>", return the string "<code>important</code>" and terminate these
1997-
steps.
1998-
</ol>
1999-
<li>Otherwise, follow these substeps:
1994+
<li>If <var>property</var> is not a <a>custom property</a>, follow these substeps:
20001995
<ol>
2001-
<li>If <var>property</var> is a
2002-
<a>case-sensitive</a> match for a <a for="CSS declaration">property name</a> of a <a>CSS
2003-
declaration</a> in the <a for="CSSStyleDeclaration">declarations</a> that has the
2004-
<a for="CSS declaration">important flag</a> set, return the string "<code>important</code>".
1996+
<li>Let <var>property</var> be <var>property</var> <a>converted to ASCII lowercase</a>.
1997+
<li>If <var>property</var> is a shorthand property, follow these substeps:
1998+
<ol>
1999+
<li>Let <var>list</var> be a new array.
2000+
<li>For each longhand property <var>longhand</var> that <var>property</var> maps to, append the result of invoking
2001+
{{CSSStyleDeclaration/getPropertyPriority()}} with <var>longhand</var> as argument to <var>list</var>.
2002+
<li>If all items in <var>list</var> are the string "<code>important</code>", return the string "<code>important</code>" and terminate these
2003+
steps.
2004+
</ol>
20052005
</ol>
2006+
<li>If <var>property</var> is a
2007+
<a>case-sensitive</a> match for a <a for="CSS declaration">property name</a> of a <a>CSS
2008+
declaration</a> in the <a for="CSSStyleDeclaration">declarations</a> that has the
2009+
<a for="CSS declaration">important flag</a> set, return the string "<code>important</code>".
20062010
<li>Return the empty string.
20072011
</ol>
20082012
<div class=example>E.g. for <code>background-color:lime !IMPORTANT</code> the return
@@ -2012,9 +2016,11 @@ The <dfn method for=CSSStyleDeclaration>setProperty(<var>property</var>, <var>va
20122016
<ol>
20132017
<li>If the <a for="CSSStyleDeclaration">readonly flag</a> is set, <a>throw</a>
20142018
a {{NoModificationAllowedError}} exception and terminate these steps.
2015-
<li>Let <var>property</var> be <var>property</var> <a>converted to ASCII lowercase</a>.
2016-
<li>If <var>property</var> is not a <a>case-sensitive</a> match for a <a>supported CSS property</a>, terminate this
2017-
algorithm.
2019+
<li>If <var>property</var> is not a <a>custom property</a>, follow these substeps:
2020+
<ol>
2021+
<li>Let <var>property</var> be <var>property</var> <a>converted to ASCII lowercase</a>.
2022+
<li>If <var>property</var> is not a <a>case-sensitive</a> match for a <a>supported CSS property</a>, terminate this algorithm.
2023+
</ol>
20182024
<li>If <var>value</var> is the empty string, invoke {{CSSStyleDeclaration/removeProperty()}}
20192025
with <var>property</var> as argument and terminate this algorithm.
20202026
<li>If <var>priority</var> is not the empty string and is not an <a>ASCII case-insensitive</a> match for the string
@@ -2052,9 +2058,11 @@ steps:
20522058
<ol>
20532059
<li>If the <a for="CSSStyleDeclaration">readonly flag</a> is set, <a>throw</a>
20542060
a {{NoModificationAllowedError}} exception and terminate these steps.
2055-
<li>Let <var>property</var> be <var>property</var> <a>converted to ASCII lowercase</a>.
2056-
<li>If <var>property</var> is not a <a>case-sensitive</a> match for a <a>supported CSS property</a>, terminate this
2057-
algorithm.
2061+
<li>If <var>property</var> is not a <a>custom property</a>, follow these substeps:
2062+
<ol>
2063+
<li>Let <var>property</var> be <var>property</var> <a>converted to ASCII lowercase</a>.
2064+
<li>If <var>property</var> is not a <a>case-sensitive</a> match for a <a>supported CSS property</a>, terminate this algorithm.
2065+
</ol>
20582066
<li>If <var>value</var> is the empty string, invoke {{CSSStyleDeclaration/removeProperty()}}
20592067
with <var>property</var> as argument and terminate this algorithm.
20602068
<li>
@@ -2086,9 +2094,11 @@ these steps:
20862094
<ol>
20872095
<li>If the <a for="CSSStyleDeclaration">readonly flag</a> is set, <a>throw</a>
20882096
a {{NoModificationAllowedError}} exception and terminate these steps.
2089-
<li>Let <var>property</var> be <var>property</var> <a>converted to ASCII lowercase</a>.
2090-
<li>If <var>property</var> is not a <a>case-sensitive</a> match for a <a>supported CSS property</a>, terminate this
2091-
algorithm.
2097+
<li>If <var>property</var> is not a <a>custom property</a>, follow these substeps:
2098+
<ol>
2099+
<li>Let <var>property</var> be <var>property</var> <a>converted to ASCII lowercase</a>.
2100+
<li>If <var>property</var> is not a <a>case-sensitive</a> match for a <a>supported CSS property</a>, terminate this algorithm.
2101+
</ol>
20922102
<li>If <var>priority</var> is not the empty string and is not an <a>ASCII case-insensitive</a> match for the string
20932103
"<code>important</code>", terminate this algorithm.
20942104
<li>If <var>property</var> is a shorthand property, then for each longhand property <var>longhand</var> that <var>property</var> maps to, in canonical
@@ -2115,7 +2125,8 @@ The <dfn method for=CSSStyleDeclaration>removeProperty(<var>property</var>)</dfn
21152125
<ol>
21162126
<li>If the <a for="CSSStyleDeclaration">readonly flag</a> is set, <a>throw</a>
21172127
a {{NoModificationAllowedError}} exception and terminate these steps.
2118-
<li>Let <var>property</var> be <var>property</var> <a>converted to ASCII lowercase</a>.
2128+
<li>If <var>property</var> is not a <a>custom property</a>,
2129+
let <var>property</var> be <var>property</var> <a>converted to ASCII lowercase</a>.
21192130
<li>Let <var>value</var> be the return value of invoking {{CSSStyleDeclaration/getPropertyValue()}}
21202131
with <var>property</var> as argument.
21212132
<li>If <var>property</var> is a shorthand property, for each longhand property <var>longhand</var> that <var>property</var> maps to, invoke

0 commit comments

Comments
 (0)