Skip to content

Commit e24d27d

Browse files
committed
define some CSSRule.cssText serialization stuff
1 parent e506cbc commit e24d27d

2 files changed

Lines changed: 180 additions & 78 deletions

File tree

cssom/Overview.html

Lines changed: 99 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
<div class=head>
2626
<h1 id=cssom>CSSOM</h1>
2727

28-
<h2 class="no-num no-toc" id="">Editor's Draft 11 March 2010</h2>
28+
<h2 class="no-num no-toc" id="">Editor's Draft 12 March 2010</h2>
2929

3030
<dl>
3131
<dt>This Version:
3232

3333
<dd><a
34-
href="http://www.w3.org/TR/2010/ED-cssom-20100311/">http://www.w3.org/TR/2010/ED-cssom-20100311/</a>
34+
href="http://www.w3.org/TR/2010/ED-cssom-20100312/">http://www.w3.org/TR/2010/ED-cssom-20100312/</a>
3535

3636
<dt>Latest Version:
3737

@@ -936,47 +936,47 @@ <h4 id=the-stylesheet-interface><span class=secno>6.1.1. </span>The <code
936936
href="#stylesheet">StyleSheet</a></code> interface.
937937

938938
<pre class=idl>interface <dfn id=stylesheet>StyleSheet</dfn> {
939-
readonly attribute DOMString <a href="#stylesheet-type" title=stylesheet-type>type</a>;
940-
readonly attribute DOMString <a href="#stylesheet-href" title=stylesheet-href>href</a>;
941-
readonly attribute Node <a href="#stylesheet-ownernode" title=stylesheet-ownernode>ownerNode</a>;
942-
readonly attribute <a href="#stylesheet">StyleSheet</a> <a href="#stylesheet-parentstylesheet" title=stylesheet-parentstylesheet>parentStyleSheet</a>;
943-
readonly attribute DOMString <a href="#stylesheet-title" title=stylesheet-title>title</a>;
944-
[PutForwards=<a href="#dom-medialist-mediatext" title=dom-MediaList-mediaText>mediaText</a>] readonly attribute <a href="#medialist">MediaList</a> <a href="#stylesheet-media" title=stylesheet-media>media</a>;
945-
attribute boolean <a href="#stylesheet-disabled" title=stylesheet-disabled>disabled</a>;
939+
readonly attribute DOMString <a href="#dom-stylesheet-type" title=dom-StyleSheet-type>type</a>;
940+
readonly attribute DOMString <a href="#dom-stylesheet-href" title=dom-StyleSheet-href>href</a>;
941+
readonly attribute Node <a href="#dom-stylesheet-ownernode" title=dom-StyleSheet-ownerNode>ownerNode</a>;
942+
readonly attribute <a href="#stylesheet">StyleSheet</a> <a href="#dom-stylesheet-parentstylesheet" title=dom-StyleSheet-parentStyleSheet>parentStyleSheet</a>;
943+
readonly attribute DOMString <a href="#dom-stylesheet-title" title=dom-StyleSheet-title>title</a>;
944+
[PutForwards=<a href="#dom-medialist-mediatext" title=dom-MediaList-mediaText>mediaText</a>] readonly attribute <a href="#medialist">MediaList</a> <a href="#dom-stylesheet-media" title=dom-StyleSheet-media>media</a>;
945+
attribute boolean <a href="#dom-stylesheet-disabled" title=dom-StyleSheet-disabled>disabled</a>;
946946
};</pre>
947947

948-
<p>The <dfn id=stylesheet-type
949-
title=stylesheet-type><code>type</code></dfn> attribute <em
948+
<p>The <dfn id=dom-stylesheet-type
949+
title=dom-StyleSheet-type><code>type</code></dfn> attribute <em
950950
class=ct>must</em> return the <a href="#style-sheet-type">style sheet
951951
type</a>.
952952

953-
<p>The <dfn id=stylesheet-href
954-
title=stylesheet-href><code>href</code></dfn> attribute <em
953+
<p>The <dfn id=dom-stylesheet-href
954+
title=dom-StyleSheet-href><code>href</code></dfn> attribute <em
955955
class=ct>must</em> return the <a href="#style-sheet-location">style sheet
956956
location</a>.
957957

958-
<p>The <dfn id=stylesheet-ownernode
959-
title=stylesheet-ownernode><code>ownerNode</code></dfn> attribute <em
958+
<p>The <dfn id=dom-stylesheet-ownernode
959+
title=dom-StyleSheet-ownerNode><code>ownerNode</code></dfn> attribute <em
960960
class=ct>must</em> return the <a href="#style-sheet-node">style sheet
961961
node</a>.
962962

963-
<p>The <dfn id=stylesheet-parentstylesheet
964-
title=stylesheet-parentstylesheet><code>parentStyleSheet</code></dfn>
963+
<p>The <dfn id=dom-stylesheet-parentstylesheet
964+
title=dom-StyleSheet-parentStyleSheet><code>parentStyleSheet</code></dfn>
965965
attribute <em class=ct>must</em> return the <a
966966
href="#style-sheet-parent">style sheet parent</a>.
967967

968-
<p>The <dfn id=stylesheet-title
969-
title=stylesheet-title><code>title</code></dfn> attribute <em
968+
<p>The <dfn id=dom-stylesheet-title
969+
title=dom-StyleSheet-title><code>title</code></dfn> attribute <em
970970
class=ct>must</em> return the <a href="#style-sheet-title">style sheet
971971
title</a>.
972972

973-
<p>The <dfn id=stylesheet-media
974-
title=stylesheet-media><code>media</code></dfn> attribute <em
973+
<p>The <dfn id=dom-stylesheet-media
974+
title=dom-StyleSheet-media><code>media</code></dfn> attribute <em
975975
class=ct>must</em> return the <a href="#style-sheet-media">style sheet
976976
media</a>.
977977

978-
<p>The <dfn id=stylesheet-disabled
979-
title=stylesheet-disabled><code>disabled</code></dfn> attribute <em
978+
<p>The <dfn id=dom-stylesheet-disabled
979+
title=dom-StyleSheet-disabled><code>disabled</code></dfn> attribute <em
980980
class=ct>must</em>, on getting, return the <a
981981
href="#style-sheet-disabled-flag">style sheet disabled flag</a>. On
982982
setting, it <em class=ct>must</em> set the <a
@@ -1918,15 +1918,72 @@ <h4 id=the-cssrule-interface><span class=secno>7.2.2. </span>The <code
19181918
object</var> is the object of which this attribute is set.
19191919

19201920
<p>On getting the <code title=dom-CSSRule-cssText><a
1921-
href="#dom-cssrule-csstext">cssText</a></code> attribute, <span
1922-
class=issue>...</span>.</p>
1923-
<!-- XXX the serialization depends on the type -->
1921+
href="#dom-cssrule-csstext">cssText</a></code> attribute, a serialization
1922+
of the object <em class=ct>must</em> be returned. The serialization
1923+
depends on the object, as follows:
1924+
1925+
<dl>
1926+
<dt><code><a href="#cssstylerule">CSSStyleRule</a></code>
1927+
1928+
<dd class=XXX>...
1929+
1930+
<dt><code><a href="#cssimportrule">CSSImportRule</a></code>
1931+
1932+
<dd>
1933+
<p>The result of concatenating these strings:</p>
1934+
1935+
<ol>
1936+
<li>The literal string "<code>@import</code>", followed by a space
1937+
(U+0020), followed by the literal string '<code><a
1938+
href="#url">url("</a></code>', followed by the <a
1939+
href="#escape-a-string" title="escape a string">escaped</a> value of
1940+
the <code title=dom-CSSImportRule-href><a
1941+
href="#dom-cssimportrule-href">href</a></code> attribute, followed by
1942+
'<code>")</code>'.
1943+
1944+
<li>If the associated <code><a href="#medialist">MediaList</a></code>
1945+
object is not empty, a space (U+0020), followed by the value of the
1946+
<code title=dom-MediaList-mediaText><a
1947+
href="#dom-medialist-mediatext">mediaText</a></code> attribute of the
1948+
associated <code><a href="#medialist">MediaList</a></code> object.
1949+
1950+
<li>A "<code>;</code>" (U+003B).
1951+
</ol>
1952+
1953+
<dt><code><a href="#cssmediarule">CSSMediaRule</a></code>
1954+
1955+
<dd class=XXX>...
1956+
1957+
<dt><code><a href="#cssfontfacerule">CSSFontFaceRule</a></code>
1958+
1959+
<dd class=XXX>...
1960+
1961+
<dt><code><a href="#csspagerule">CSSPageRule</a></code>
1962+
1963+
<dd class=XXX>...
1964+
1965+
<dt><code><a href="#cssnamespacerule">CSSNamespaceRule</a></code>
1966+
1967+
<dd>
1968+
<p>The literal string "<code>@namespace</code>", followed by a space
1969+
(U+0020), followed by the <a href="#escape-an-identifier" title="escape
1970+
an identifier">identifier escaped</a> value of the <code
1971+
title=dom-CSSNamespaceRule-prefix><a
1972+
href="#dom-cssnamespacerule-prefix">prefix</a></code> attribute (if
1973+
any), followed by a space (U+0020) if there is a prefix, followed by the
1974+
literal string '<code><a href="#url">url("</a></code>' followed by the
1975+
<a href="#escape-a-string" title="escape a string">string escaped</a>
1976+
value of the <code title=dom-CSSNamespaceRule-namespaceURI><a
1977+
href="#dom-cssnamespacerule-namespaceuri">namespaceURI</a></code>
1978+
attribute, followed by the literal string '<code>");</code>'.
1979+
</dl>
19241980

19251981
<p>The <dfn id=dom-cssrule-parentrule
19261982
title=dom-CSSRule-parentRule><code>parentRule</code></dfn> attribute <em
19271983
class=ct>must</em> return the nearest enclosing rule of the current rule
1928-
or <code>null</code>, if there is no enclosing rule. For example, an <code
1929-
title="">@media</code> block enclosing the current rule.
1984+
or null, if there is no enclosing rule.
1985+
1986+
<p class=note>E.g. <code title="">@media</code> can enclose a rule.
19301987

19311988
<p>The <dfn id=dom-cssrule-parentstylesheet
19321989
title=dom-CSSRule-parentStyleSheet><code>parentStyleSheet</code></dfn>
@@ -2009,28 +2066,30 @@ <h4 id=css-import-rule><span class=secno>7.2.4. </span>CSS <code
20092066

20102067
<p>The <dfn id=dom-cssimportrule-href
20112068
title=dom-CSSImportRule-href><code>href</code></dfn> attribute, on
2012-
getting, <em class=ct>must</em> return the <i>specified</i> <a
2013-
href="#url">URL</a> of the <span>CSS style sheet</span> referenced by the
2014-
<code>@import</code> rule.
2069+
getting, <em class=ct>must</em> return the <a href="#url">URL</a>
2070+
specified by the <code>@import</code> rule.
20152071

2016-
<p class=XXX>Returning the <span>absolute URL</span> would be much better,
2017-
but only Opera does this at the moment. Convince Gecko/WebKit?
2072+
<p class=note>To get the resolved <a href="#url">URL</a> use the <code
2073+
title=dom-StyleSheet-href><a href="#dom-stylesheet-href">href</a></code>
2074+
attribute of the associated <code><a
2075+
href="#cssstylesheet">CSSStyleSheet</a></code> object.
20182076

20192077
<p>The <dfn id=dom-cssimportrule-media
20202078
title=dom-CSSImportRule-media><code>media</code></dfn> attribute, on
2021-
getting, <em class=ct>must</em> return a <code><a
2022-
href="#medialist">MediaList</a></code> object for the list of media
2023-
queries specified with the <code>@import</code> rule.
2079+
getting, <em class=ct>must</em> return the value of the <code
2080+
title=dom-StyleSheet-media><a
2081+
href="#dom-stylesheet-media">media</a></code> attribute of the associated
2082+
<code><a href="#cssstylesheet">CSSStyleSheet</a></code> object.
20242083

20252084
<p>The <dfn id=dom-cssimportrule-stylesheet
20262085
title=dom-CSSImportRule-stylesheet><code>styleSheet</code></dfn>
2027-
attribute, on getting, <em class=ct>must</em> return the <code><a
2028-
href="#cssstylesheet">CSSStyleSheet</a></code> object that represents the
2029-
referenced (parsed) <span>CSS style sheet</span> from the
2030-
<code>@import</code> rule.
2086+
attribute, on getting, <em class=ct>must</em> return the associated
2087+
<code><a href="#cssstylesheet">CSSStyleSheet</a></code> object.
20312088

20322089
<p class=note>If loading of the style sheet fails its <code
20332090
title=dom-CSSStyleSheet-cssRules>cssRules</code> list is simply empty.
2091+
I.e. an <code>@import</code> rule always has an associated <code><a
2092+
href="#cssstylesheet">CSSStyleSheet</a></code> object.
20342093

20352094
<h4 id=css-media-rule><span class=secno>7.2.5. </span>CSS <code
20362095
title="">@media</code> Rule</h4>

cssom/Overview.src.html

Lines changed: 81 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -683,49 +683,49 @@ <h4>The <code title="">StyleSheet</code> Interface</h4>
683683

684684
<p>In the DOM a <span>style sheet</span> is represented by an object that
685685
implements the <code>StyleSheet</code> interface.</p>
686-
686+
687687
<pre class="idl">interface <dfn id="stylesheet">StyleSheet</dfn> {
688-
readonly attribute DOMString <span title="stylesheet-type">type</span>;
689-
readonly attribute DOMString <span title="stylesheet-href">href</span>;
690-
readonly attribute Node <span title="stylesheet-ownernode">ownerNode</span>;
691-
readonly attribute <span>StyleSheet</span> <span title="stylesheet-parentstylesheet">parentStyleSheet</span>;
692-
readonly attribute DOMString <span title="stylesheet-title">title</span>;
693-
[PutForwards=<span title="dom-MediaList-mediaText">mediaText</span>] readonly attribute <span>MediaList</span> <span title="stylesheet-media">media</span>;
694-
attribute boolean <span title="stylesheet-disabled">disabled</span>;
688+
readonly attribute DOMString <span title="dom-StyleSheet-type">type</span>;
689+
readonly attribute DOMString <span title="dom-StyleSheet-href">href</span>;
690+
readonly attribute Node <span title="dom-StyleSheet-ownerNode">ownerNode</span>;
691+
readonly attribute <span>StyleSheet</span> <span title="dom-StyleSheet-parentStyleSheet">parentStyleSheet</span>;
692+
readonly attribute DOMString <span title="dom-StyleSheet-title">title</span>;
693+
[PutForwards=<span title="dom-MediaList-mediaText">mediaText</span>] readonly attribute <span>MediaList</span> <span title="dom-StyleSheet-media">media</span>;
694+
attribute boolean <span title="dom-StyleSheet-disabled">disabled</span>;
695695
};</pre>
696696

697697
<p>The
698-
<dfn id="stylesheet-type" title="stylesheet-type"><code>type</code></dfn>
698+
<dfn id="dom-stylesheet-type" title="dom-StyleSheet-type"><code>type</code></dfn>
699699
attribute <em class="ct">must</em> return the
700700
<span>style sheet type</span>.</p>
701-
701+
702702
<p>The
703-
<dfn id="stylesheet-href" title="stylesheet-href"><code>href</code></dfn>
703+
<dfn id="dom-stylesheet-href" title="dom-StyleSheet-href"><code>href</code></dfn>
704704
attribute <em class="ct">must</em> return the
705705
<span>style sheet location</span>.</p>
706-
706+
707707
<p>The
708-
<dfn id="stylesheet-ownernode" title="stylesheet-ownernode"><code>ownerNode</code></dfn>
708+
<dfn id="dom-stylesheet-ownernode" title="dom-StyleSheet-ownerNode"><code>ownerNode</code></dfn>
709709
attribute <em class="ct">must</em> return the
710710
<span>style sheet node</span>.</p>
711711

712712
<p>The
713-
<dfn id="stylesheet-parentstylesheet" title="stylesheet-parentstylesheet"><code>parentStyleSheet</code></dfn>
713+
<dfn id="dom-stylesheet-parentstylesheet" title="dom-StyleSheet-parentStyleSheet"><code>parentStyleSheet</code></dfn>
714714
attribute <em class="ct">must</em> return the
715715
<span>style sheet parent</span>.</p>
716716

717717
<p>The
718-
<dfn id="stylesheet-title" title="stylesheet-title"><code>title</code></dfn>
718+
<dfn id="dom-stylesheet-title" title="dom-StyleSheet-title"><code>title</code></dfn>
719719
attribute <em class="ct">must</em> return the
720720
<span>style sheet title</span>.</p>
721721

722722
<p>The
723-
<dfn id="stylesheet-media" title="stylesheet-media"><code>media</code></dfn>
723+
<dfn id="dom-stylesheet-media" title="dom-StyleSheet-media"><code>media</code></dfn>
724724
attribute <em class="ct">must</em> return the
725725
<span>style sheet media</span>.</p>
726726

727727
<p>The
728-
<dfn id="stylesheet-disabled" title="stylesheet-disabled"><code>disabled</code></dfn>
728+
<dfn id="dom-stylesheet-disabled" title="dom-StyleSheet-disabled"><code>disabled</code></dfn>
729729
attribute <em class="ct">must</em>, on getting, return the
730730
<span>style sheet disabled flag</span>. On setting, it
731731
<em class="ct">must</em> set the <span>style sheet disabled flag</span> to
@@ -1536,15 +1536,58 @@ <h4>The <code title="">CSSRule</code> Interface</h4>
15361536
set.</p>
15371537

15381538
<p>On getting the <code title="dom-CSSRule-cssText">cssText</code>
1539-
attribute, <span class="issue">...</span>.</p>
1539+
attribute, a serialization of the object <em class="ct">must</em> be
1540+
returned. The serialization depends on the object, as follows:</p>
1541+
1542+
<dl>
1543+
<dt><code>CSSStyleRule</code></dt>
1544+
<dd class=XXX>...</dd>
1545+
1546+
<dt><code>CSSImportRule</code></dt>
1547+
<dd>
1548+
<p>The result of concatenating these strings:</p>
1549+
<ol>
1550+
<li>The literal string "<code>@import</code>", followed by a space
1551+
(U+0020), followed by the literal string '<code>url("</code>', followed
1552+
by the <span title="escape a string">escaped</span> value of the
1553+
<code title="dom-CSSImportRule-href">href</code> attribute, followed by
1554+
'<code>")</code>'.</li>
1555+
<li>If the associated <code>MediaList</code> object is not empty, a
1556+
space (U+0020), followed by the value of the
1557+
<code title="dom-MediaList-mediaText">mediaText</code> attribute of the
1558+
associated <code>MediaList</code> object.</li>
1559+
<li>A "<code>;</code>" (U+003B).</li>
1560+
</ol>
1561+
</dd>
1562+
1563+
<dt><code>CSSMediaRule</code></dt>
1564+
<dd class=XXX>...</dd>
1565+
1566+
<dt><code>CSSFontFaceRule</code></dt>
1567+
<dd class=XXX>...</dd>
1568+
1569+
<dt><code>CSSPageRule</code></dt>
1570+
<dd class=XXX>...</dd>
1571+
1572+
<dt><code>CSSNamespaceRule</code></dt>
1573+
<dd><p>The literal string "<code>@namespace</code>", followed by a space
1574+
(U+0020), followed by the
1575+
<span title="escape an identifier">identifier escaped</span> value of the
1576+
<code title="dom-CSSNamespaceRule-prefix">prefix</code> attribute (if
1577+
any), followed by a space (U+0020) if there is a prefix, followed by the
1578+
literal string '<code>url("</code>' followed by the
1579+
<span title="escape a string">string escaped</span> value of the
1580+
<code title="dom-CSSNamespaceRule-namespaceURI">namespaceURI</code>
1581+
attribute, followed by the literal string '<code>");</code>'.</p></dd>
1582+
</dl>
15401583

1541-
<!-- XXX the serialization depends on the type -->
15421584

15431585
<p>The
15441586
<dfn id="dom-cssrule-parentrule" title="dom-CSSRule-parentRule"><code>parentRule</code></dfn>
15451587
attribute <em class="ct">must</em> return the nearest enclosing rule of the
1546-
current rule or <code>null</code>, if there is no enclosing rule. For example,
1547-
an <code title="">@media</code> block enclosing the current rule.</p>
1588+
current rule or null, if there is no enclosing rule.</p>
1589+
1590+
<p class="note">E.g. <code title="">@media</code> can enclose a rule.</p>
15481591

15491592
<p>The
15501593
<dfn id="dom-cssrule-parentstylesheet" title="dom-CSSRule-parentStyleSheet"><code>parentStyleSheet</code></dfn>
@@ -1585,18 +1628,18 @@ <h4>CSS Style Rule (Rule Set)</h4>
15851628
attribute, on getting, <em class="ct">must</em> return the result of
15861629
<span title="serialize a group of selectors">serializing</span> the
15871630
associated <span>group of selectors</span>.</p>
1588-
1631+
15891632
<p>On setting the
15901633
<code title="dom-CSSStyleRule-selectorText">selectorText</code> attribute
15911634
these steps <em class="ct">must</em> be run:</p>
1592-
1635+
15931636
<ol>
15941637
<li><p>Run the <span>parse a group of selectors</span> algorithm on the
15951638
given value.</p></li>
1596-
1639+
15971640
<li><p>If the algorithm returns a non-null value replace the associated
15981641
<span>group of selectors</span> with the returned value.</p></li>
1599-
1642+
16001643
<li><p>Otherwise, if the algorithm returns a null value, do
16011644
nothing.</p></li>
16021645
</ol>
@@ -1621,27 +1664,27 @@ <h4>CSS <code title="">@import</code> Rule</h4>
16211664
<p>The
16221665
<dfn id="dom-cssimportrule-href" title="dom-CSSImportRule-href"><code>href</code></dfn>
16231666
attribute, on getting, <em class="ct">must</em> return the
1624-
<i>specified</i> <span>URL</span> of the <span>CSS style sheet</span>
1625-
referenced by the <code>@import</code> rule.</p>
1626-
1627-
<p class="XXX">Returning the <span>absolute URL</span> would be much
1628-
better, but only Opera does this at the moment. Convince Gecko/WebKit?</p>
1667+
<span>URL</span> specified by the <code>@import</code> rule.</p>
1668+
1669+
<p class="note">To get the resolved <span>URL</span> use the
1670+
<code title="dom-StyleSheet-href">href</code> attribute of the associated
1671+
<code>CSSStyleSheet</code> object.</p>
16291672

16301673
<p>The
16311674
<dfn id="dom-cssimportrule-media" title="dom-CSSImportRule-media"><code>media</code></dfn>
1632-
attribute, on getting, <em class="ct">must</em> return a
1633-
<code>MediaList</code> object for the list of media queries specified
1634-
with the <code>@import</code> rule.</p>
1675+
attribute, on getting, <em class="ct">must</em> return the value of the
1676+
<code title="dom-StyleSheet-media">media</code> attribute of the
1677+
associated <code>CSSStyleSheet</code> object.</p>
16351678

16361679
<p>The
16371680
<dfn id="dom-cssimportrule-stylesheet" title="dom-CSSImportRule-stylesheet"><code>styleSheet</code></dfn>
1638-
attribute, on getting, <em class="ct">must</em> return the
1639-
<code>CSSStyleSheet</code> object that represents the referenced (parsed)
1640-
<span>CSS style sheet</span> from the <code>@import</code> rule.</p>
1641-
1681+
attribute, on getting, <em class="ct">must</em> return the associated
1682+
<code>CSSStyleSheet</code> object.</p>
1683+
16421684
<p class="note">If loading of the style sheet fails its
16431685
<code title="dom-CSSStyleSheet-cssRules">cssRules</code> list is simply
1644-
empty.</p>
1686+
empty. I.e. an <code>@import</code> rule always has an associated
1687+
<code>CSSStyleSheet</code> object.</p>
16451688

16461689

16471690
<h4>CSS <code title="">@media</code> Rule</h4>

0 commit comments

Comments
 (0)