Skip to content

Commit 5f1b63c

Browse files
Anders Hartvoll Ruudemilio
Anders Hartvoll Ruud
authored andcommitted
[cssom] Don't serialize empty rules
With CSSOM, it's possible to reach into a CSSNestedDeclarations rule and remove its declarations, causing it to serialize as the empty string. Such rules add "whitespace junk" when serializing the outer rule, which looks unattractive. Fixed by ignoring rules that serialize to the empty string.
1 parent 065b17d commit 5f1b63c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

cssom-1/Overview.bs

+8-4
Original file line numberDiff line numberDiff line change
@@ -1709,10 +1709,14 @@ To <dfn export>serialize a CSS rule</dfn>, perform one of the following in accor
17091709
<ol>
17101710
<li>If |decls| is not null, prepend it to |rules|.
17111711
<li>For each |rule| in |rules|:
1712-
<ol>
1713-
<li>Append a newline followed by two spaces to |s|.
1714-
<li>Append |rule| to |s|.
1715-
</ol>
1712+
<ul>
1713+
<li>If |rule| is the empty string, do nothing.
1714+
<li>Otherwise:
1715+
<ol>
1716+
<li>Append a newline followed by two spaces to |s|.
1717+
<li>Append |rule| to |s|.
1718+
</ol>
1719+
</ul>
17161720
<li>Append a newline followed by RIGHT CURLY BRACKET (U+007D) to |s|.
17171721
<li>Return |s|.
17181722
</ol>

0 commit comments

Comments
 (0)