Skip to content

Commit ad2af0c

Browse files
committed
[cssom] (1) format 'null' using code styling;
(2) update cssom generated references; (3) elaborate CSS rule serialization rules for import rule;
1 parent 469e4d8 commit ad2af0c

11 files changed

Lines changed: 140 additions & 72 deletions

cssom/Overview.html

Lines changed: 31 additions & 32 deletions
Large diffs are not rendered by default.

cssom/cssom-generate.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
(function() {
2-
var HTML5 = require('html5'),
2+
var html5 = require('html5'),
33
events = require('events'),
44
util = require('util'),
55
fs = require('fs');
66
var output = '';
7-
var parser = new HTML5.Parser();
7+
var parser = new html5.Parser();
88
var idl = null;
99
function augmentIDL(idl) {
1010
return augmentIDLDefinitions(idl);
@@ -63,7 +63,7 @@
6363
'data-anolis-ref'
6464
];
6565
function isBooleanAttr(ln,n) {
66-
if ( ( HTML5.BOOLEAN_ATTRIBUTES [ ln ] || [] ).indexOf(n) != -1 ) {
66+
if ( ( html5.BOOLEAN_ATTRIBUTES [ ln ] || [] ).indexOf(n) != -1 ) {
6767
return true;
6868
} else if ( ANOLIS_BOOLEAN_ATTRIBUTES.indexOf(n) != -1 ) {
6969
return true;
@@ -954,7 +954,7 @@
954954
s += eltEnd ( 'a' );
955955
return s;
956956
}
957-
var rQuote = new RegExp ( '[' + HTML5.SPACE_CHARACTERS_IN + '<=>\'\"' + ']' );
957+
var rQuote = new RegExp ( '[' + html5.SPACE_CHARACTERS_IN + '<=>\'\"' + ']' );
958958
var alwaysQuote = true;
959959
function formatAttr(a,ln) {
960960
var n = a.nodeName;
@@ -985,7 +985,6 @@
985985
return newChars;
986986
}
987987
var $ = {
988-
output : '',
989988
ondata : function(data) {
990989
output += data;
991990
},
@@ -1019,7 +1018,7 @@
10191018
}
10201019
},
10211020
onend : function() {
1022-
new HTML5.TreeWalker ( parser.tree.document, $.ontoken );
1021+
new html5.TreeWalker ( parser.tree.document, $.ontoken );
10231022
util.puts ( output );
10241023
},
10251024
run : function(argv) {

cssom/cssom-source

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@
212212
by the concatenation of, for each character of the identifier:</p>
213213

214214
<ul>
215-
<li>If the character is NULL (U+0000), then <span data-anolis-spec=dom title=concept-throw>throw</span> a
215+
<li>If the character is NULL (U+0000), then <span data-anolis-spec=dom title=concept-throw>throw</span> an
216216
<code data-anolis-spec=dom>InvalidCharacterError</code> exception and terminate these steps.</li>
217217
<li>If the character is in the range [\1-\1f] (U+0001 to U+001F) or
218218
[\7f-\9f] (U+007F to U+009F), then the character
@@ -242,7 +242,7 @@
242242
'<code>"</code>' (U+0022):</p>
243243

244244
<ul>
245-
<li>If the character is NULL (U+0000), then <span data-anolis-spec=dom title=concept-throw>throw</span> a
245+
<li>If the character is NULL (U+0000), then <span data-anolis-spec=dom title=concept-throw>throw</span> an
246246
<code data-anolis-spec=dom>InvalidCharacterError</code> exception and terminate these steps.</li>
247247
<li>If the character is in the range [\1-\1f] (U+0001 to U+001F) or [\7f-\9f] (U+007F to
248248
U+009F), the character <span title="escape a character as code point">escaped as code point</span>.</li>
@@ -748,13 +748,13 @@
748748
<p>In the following, the <span>style sheet title</span> is non-empty
749749
for the first style sheet, but is empty for the second and third style sheets.</p>
750750
<pre>&lt;style title="papaya">
751-
body { background:papayawhip }
751+
body { background: papayawhip; }
752752
&lt;/style></pre>
753753
<pre>&lt;style title="">
754-
body { background:orange }
754+
body { background: orange; }
755755
&lt;/style></pre>
756756
<pre>&lt;style>
757-
body { background:brown }
757+
body { background: brown; }
758758
&lt;/style></pre>
759759
</div>
760760
</dd>
@@ -1340,7 +1340,7 @@
13401340
<p class="issue">Should a rule be instantiated in OM if there is a parse error? To
13411341
what extent should original (but non-valid) CSS text be captured in cssText?</p>
13421342

1343-
<p>To <dfn>serialize a CSS rule</dfn>, perform one of the following in accordance with the its <span>rule type</span>:</p>
1343+
<p>To <dfn>serialize a CSS rule</dfn>, perform one of the following in accordance with the <span title="rule type">rule's type</span>:</p>
13441344

13451345
<dl class="switch">
13461346
<dt><code>CSSStyleRule</code></dt>
@@ -1373,16 +1373,15 @@
13731373
<dd>
13741374
<p>The result of concatenating the following:</p>
13751375
<ol>
1376-
<li>The string "<code>@import</code>" followed by a single SPACE
1377-
(U+0020), followed by the <span title="serialize a URL">URL escaped</span>
1378-
value of the <code title="dom-CSSImportRule-href">href</code>
1379-
attribute.</li>
1380-
<li>If the associated <code>MediaList</code> object is not empty, a
1381-
single SPACE (U+0020), followed by the value of the
1382-
<code title="dom-MediaList-mediaText">mediaText</code> attribute of the
1383-
associated <code>MediaList</code> object.</li>
1384-
<li>A "<code>;</code>" (U+003B).</li>
1376+
<li>The string "<code>@import</code>" followed by a single SPACE (U+0020).</li>
1377+
<li>The result of performing <span>serialize a URL</span> on the rule's location.</li>
1378+
<li>If the rule's associated media list is not empty, a single SPACE (U+0020) followed by the
1379+
result of performing <span>serialize a media query list</span> on the media list.
1380+
<li>The string "<code>;</code>", i.e., SEMICOLON (U+003B).
13851381
</ol>
1382+
<div class="example">
1383+
<pre>@import url("print.css") print;</pre>
1384+
</div>
13861385
</dd>
13871386

13881387
<dt><code>CSSMediaRule</code></dt>

cssom/data/xrefs/css/cssom.json

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,72 @@
1-
{ "definitions": {}, "url": "http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom/Overview.html#" }
1+
{
2+
"definitions": {
3+
"add a style sheet": "add-a-style-sheet",
4+
"associated style sheet": "associated-style-sheet",
5+
"change the preferred style sheet set name": "change-the-preferred-style-sheet-set-name",
6+
"clear": "clear",
7+
"collection of media queries": "collection-of-media-queries",
8+
"compare media queries": "compare-media-queries",
9+
"create a medialist object": "create-a-medialist-object",
10+
"create a style sheet": "create-a-style-sheet",
11+
"css declaration block": "css-declaration-block",
12+
"css declaration block declarations": "css-declaration-block-declarations",
13+
"css declaration block readonly flag": "css-declaration-block-readonly-flag",
14+
"css rule": "rule",
15+
"css style sheet": "css-style-sheet",
16+
"document style sheets": "document-style-sheets",
17+
"enable a style sheet set": "enable-a-style-sheet-set",
18+
"enabled style sheet set": "enabled-style-sheet-set",
19+
"escape a character": "escape-a-character",
20+
"escape a character as code point": "escape-a-character-as-code-point",
21+
"http-default-style": "default-style",
22+
"insert a css rule": "insert-a-css-rule",
23+
"last style sheet set name": "last-style-sheet-set-name",
24+
"parse a css declaration block": "parse-a-css-declaration-block",
25+
"parse a css page selector": "parse-a-css-page-selector",
26+
"parse a css rule": "parse-a-css-rule",
27+
"parse a css value": "parse-a-css-value",
28+
"parse a group of selectors": "parse-a-group-of-selectors",
29+
"parse a media query": "parse-a-media-query",
30+
"parse a media query list": "parse-a-media-query-list",
31+
"persistent style sheet": "persistent-style-sheet",
32+
"preferred style sheet set name": "preferred-style-sheet-set-name",
33+
"remove a css rule": "remove-a-css-rule",
34+
"resolved value": "resolved-value",
35+
"rule parent": "rule-parent",
36+
"rule parent style sheet": "rule-style-sheet",
37+
"rule text": "rule-text",
38+
"rule type": "rule-type",
39+
"select a style sheet set": "select-a-style-sheet-set",
40+
"serialize a comma-separated list": "serialize-a-comma-separated-list",
41+
"serialize a css component value": "serialize-a-css-value-component",
42+
"serialize a css declaration block": "serialize-a-css-declaration-block",
43+
"serialize a css page selector": "serialize-a-css-page-selector",
44+
"serialize a css rule": "serialize-a-css-rule",
45+
"serialize a css value": "serialize-a-css-value",
46+
"serialize a group of selectors": "serialize-a-group-of-selectors",
47+
"serialize a media feature value": "serialize-a-media-feature-value",
48+
"serialize a media query": "serialize-a-media-query",
49+
"serialize a media query list": "serialize-a-media-query-list",
50+
"serialize a selector": "serialize-a-selector",
51+
"serialize a simple selector": "serialize-a-simple-selector",
52+
"serialize a string": "serialize-a-string",
53+
"serialize a url": "serialize-a-url",
54+
"serialize a whitespace-separated list": "serialize-a-whitespace-separated-list",
55+
"serialize an identifier": "serialize-an-identifier",
56+
"set": "set",
57+
"style sheet alternate flag": "style-sheet-alternate-flag",
58+
"style sheet css rules": "style-sheet-css-rules",
59+
"style sheet disabled flag": "style-sheet-disabled-flag",
60+
"style sheet location": "style-sheet-location",
61+
"style sheet media": "style-sheet-media",
62+
"style sheet owner css rule": "style-sheet-owner-css-rule",
63+
"style sheet owner node": "style-sheet-owner-node",
64+
"style sheet parent": "style-sheet-parent",
65+
"style sheet set": "style-sheet-set",
66+
"style sheet set name": "style-sheet-set-name",
67+
"style sheet title": "style-sheet-title",
68+
"style sheet type": "style-sheet-type",
69+
"whitespace": "whitespace"
70+
},
71+
"url": "http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom/Overview.html#"
72+
}

cssom/idl/CSSPageRule.idl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface CSSPageRule : CSSRule {
1313
<ol>\
1414
<li><p>Run the <span>parse a CSS page selector</span> algorithm on the given value.</p></li>\
1515
<li><p>If the algorithm returns a non-null value replace the associated <span>CSS page selector</span> with the returned value.</p></li>\
16-
<li><p>Otherwise, if the algorithm returns a null value, do nothing.</p></li>\
16+
<li><p>Otherwise, if the algorithm returns a <code>null</code> value, do nothing.</p></li>\
1717
</ol>"
1818
]
1919
attribute DOMString selectorText;

cssom/idl/CSSStyleDeclaration.idl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ interface CSSStyleDeclaration {
2020
<li><p>If the <span>CSS declaration block readonly flag</span> is set, <span data-anolis-spec=dom title=concept-throw>throw</span> a\
2121
<code data-anolis-spec=dom>NoModificationAllowedError</code> exception and terminate these steps.</li>\
2222
<li><p>Empty the <span>CSS declaration block declarations</span>.</li>\
23-
<li><p><span title='Parse a CSS declaration block'>Parse</span> the given value and, if the return value is not null, insert it into the\
23+
<li><p><span title='Parse a CSS declaration block'>Parse</span> the given value and, if the return value is not <code>null</code>, insert it into the\
2424
<span>CSS declaration block declarations</span>.</p></li>\
2525
</ol>"
2626
]
@@ -61,7 +61,7 @@ interface CSSStyleDeclaration {
6161
<li><p>If the <var>priority</var> argument has been omitted let <var>priority</var> be the empty string.</p></li>\
6262
<li><p>If <var>priority</var> is neither a valid priority nor the empty string terminate this algorithm.</p></li>\
6363
<li>\
64-
<p>If <span title='parse a CSS value'>parsing the <var>value</var></span> returns null terminate this algorithm.\
64+
<p>If <span title='parse a CSS value'>parsing the <var>value</var></span> returns <code>null</code> terminate this algorithm.\
6565
<p class='note'><var>value</var> can not include '<code>!important</code>'.</p>\
6666
</li>\
6767
<li><p>Finally, set <var>property</var> to <var>value</var> with priority <var>priority</var> when <var>priority</var>\
@@ -83,7 +83,7 @@ interface CSSStyleDeclaration {
8383

8484
[Documentation=
8585
"<p>The {@name} {@type} must return the <code>CSSrule</code> object the <code>CSSStyleDeclaration</code> is object is associated with\
86-
or null if it is not associated with a <code>CSSrule</code> object.</p>"
86+
or <code>null</code> if it is not associated with a <code>CSSrule</code> object.</p>"
8787
]
8888
readonly attribute CSSRule? parentRule;
8989

cssom/idl/CSSStyleRule.idl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ interface CSSStyleRule : CSSRule {
1616
<ol>\
1717
<li><p>Run the <span>parse a group of selectors</span> algorithm on the given value.</p></li>\
1818
<li><p>If the algorithm returns a non-null value replace the associated <span>group of selectors</span> with the returned value.</p></li>\
19-
<li><p>Otherwise, if the algorithm returns a null value, do nothing.</p></li>\
19+
<li><p>Otherwise, if the algorithm returns a <code>null</code> value, do nothing.</p></li>\
2020
</ol>"
2121
]
2222
attribute DOMString selectorText;

cssom/idl/Document.idl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ partial interface Document {
6767
<li><p>Otherwise, if <span title='style sheet'>style sheets</span> from\
6868
different <span title='style sheet set'>style sheet sets</span> have\
6969
their <span>style sheet disabled flag</span> unset, return\
70-
null and terminate these steps.</li>\
70+
<code>null</code> and terminate these steps.</li>\
7171
\
7272
<li>\
7373
<p>Otherwise, return the empty string.</p>\
@@ -85,7 +85,7 @@ partial interface Document {
8585
attribute these steps must be run:</p>\
8686
\
8787
<ol>\
88-
<li><p>If the value is null terminate this set of steps.</p></li>\
88+
<li><p>If the value is <code>null</code> terminate this set of steps.</p></li>\
8989
<li><p>Otherwise, <span>select a style sheet set</span> with as name the\
9090
value passed.</p></li>\
9191
</ol>\
@@ -103,7 +103,7 @@ partial interface Document {
103103

104104
[Documentation=
105105
"<p>The {@name} {@type} must return the <span>last style sheet set name</span>.</p>\
106-
<p class='note'>This attribute is initially null.</p>"
106+
<p class='note'>This attribute is initially <code>null</code>.</p>"
107107
]
108108
readonly attribute DOMString? lastStyleSheetSet; // new
109109

@@ -124,7 +124,7 @@ partial interface Document {
124124
[Documentation=
125125
"<p>The {@name} {@type} must, when invoked, run these steps:</p>\
126126
<ol>\
127-
<li><p>If <var>name</var> is null terminate these steps.</p></li>\
127+
<li><p>If <var>name</var> is <code>null</code> terminate these steps.</p></li>\
128128
<li><p><span>Enable a style sheet set</span> with name <var>name</var>.</p></li>\
129129
</ol>\
130130
<p class='note'><span title='Style sheet'>Style sheets</span> with an\

cssom/idl/LinkStyle.idl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
interface LinkStyle {
77

88
[Documentation=
9-
"<p>The {@name} {@type} must return the <span>associated style sheet</span> for the node, or null,\
9+
"<p>The {@name} {@type} must return the <span>associated style sheet</span> for the node, or <code>null</code>,\
1010
if there is no <span>associated style sheet</span>.</p>"
1111
]
1212
readonly attribute StyleSheet sheet;

cssom/idl/MediaList.idl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ interface MediaList {
4040

4141
[Documentation=
4242
"<p>The {@name} method must return the media query in the <span>collection of media queries</span> given by\
43-
<var>index</var>, or null, if <var>index</var> is greater than or equal to the number of media queries in the\
43+
<var>index</var>, or <code>null</code>, if <var>index</var> is greater than or equal to the number of media queries in the\
4444
<span>collection of media queries</span>.</p>"
4545
]
4646
getter DOMString item(unsigned long index);
@@ -49,7 +49,7 @@ interface MediaList {
4949
"<p>The {@name} method must run these steps:</p>\
5050
<ol>\
5151
<li><p>Let <var>m</var> be the result of <span title='parse a media query'>parsing</span> the given value.</p></li>\
52-
<li><p>If <var>m</var> is null terminate these steps.</p></li>\
52+
<li><p>If <var>m</var> is <code>null</code> terminate these steps.</p></li>\
5353
<li><p>If <span title='compare media queries'>comparing</span> <var>m</var> with any of the media queries in the\
5454
<span>collection of media queries</span> returns true terminate these steps.</p></li>\
5555
<li><p>Append <var>m</var> to the <span>collection of media queries</span>.</p></li>\
@@ -61,7 +61,7 @@ interface MediaList {
6161
"<p>The {@name} method must run these steps:</p>\
6262
<ol>\
6363
<li><p>Let <var>m</var> be the result of <span title='parse a media query'>parsing</span> the given value.</p></li>\
64-
<li><p>If <var>m</var> is null terminate these steps.</p></li>\
64+
<li><p>If <var>m</var> is <code>null</code> terminate these steps.</p></li>\
6565
<li><p>Remove any media query from the <span>collection of media queries</span> for which\
6666
<span title='compare media queries'>comparing</span> the media query with <var>m</var> returns true.</p></li>\
6767
</ol>"

0 commit comments

Comments
 (0)