3
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
<html xmlns="http://www.w3.org/1999/xhtml">
8
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10
<title>Package cssutils.css — cssutils v0.9.7b4 documentation</title>
11
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
12
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
13
<script type="text/javascript">
14
var DOCUMENTATION_OPTIONS = {
17
COLLAPSE_INDEX: false,
22
<script type="text/javascript" src="../_static/jquery.js"></script>
23
<script type="text/javascript" src="../_static/underscore.js"></script>
24
<script type="text/javascript" src="../_static/doctools.js"></script>
25
<link rel="top" title="cssutils v0.9.7b4 documentation" href="../index.html" />
26
<link rel="next" title="Package cssutils.stylesheets" href="stylesheets.html" />
27
<link rel="prev" title="serializing CSS" href="serialize.html" />
33
<li class="right" style="margin-right: 10px">
34
<a href="../genindex.html" title="General Index"
35
accesskey="I">index</a></li>
37
<a href="../py-modindex.html" title="Python Module Index"
40
<a href="stylesheets.html" title="Package cssutils.stylesheets"
41
accesskey="N">next</a> |</li>
43
<a href="serialize.html" title="serializing CSS"
44
accesskey="P">previous</a> |</li>
45
<li><a href="../index.html">cssutils v0.9.7b4 documentation</a> »</li>
49
<div class="document">
50
<div class="documentwrapper">
51
<div class="bodywrapper">
54
<div class="section" id="module-cssutils.css">
55
<span id="package-cssutils-css"></span><h1>Package <tt class="docutils literal"><span class="pre">cssutils.css</span></tt><a class="headerlink" href="#module-cssutils.css" title="Permalink to this headline">¶</a></h1>
56
<p>Classes implementing <a class="reference external" href="http://www.w3.org/TR/DOM-Level-2-Style/css.html">DOM Level 2 CSS</a> and <a class="reference external" href="http://www.w3.org/TR/css3-namespace/">CSS Module: Namespaces (W3C Working Draft 28 August 2006)</a></p>
57
<div class="section" id="cssstylesheet">
58
<h2><tt class="docutils literal"><span class="pre">CSSStyleSheet</span></tt><a class="headerlink" href="#cssstylesheet" title="Permalink to this headline">¶</a></h2>
59
<p>A CSSStyleSheet contains all rules. It consists of the different CSS rules like <a class="reference internal" href="#cssutils.css.CSSImportRule" title="cssutils.css.CSSImportRule"><tt class="xref py py-class docutils literal"><span class="pre">CSSImportRule</span></tt></a>, <a class="reference internal" href="#cssutils.css.CSSStyleRule" title="cssutils.css.CSSStyleRule"><tt class="xref py py-class docutils literal"><span class="pre">CSSStyleRule</span></tt></a> etc. It also defines the encoding of the style sheet used for serialization. The encoding might by set with an <a class="reference internal" href="#cssutils.css.CSSCharsetRule" title="cssutils.css.CSSCharsetRule"><tt class="xref py py-class docutils literal"><span class="pre">CSSCharsetRule</span></tt></a> rule or simpler with the <a class="reference internal" href="#cssutils.css.CSSStyleSheet.encoding" title="cssutils.css.CSSStyleSheet.encoding"><tt class="xref py py-attr docutils literal"><span class="pre">encoding</span></tt></a> attribute. The serialized sheet may be obtained from <a class="reference internal" href="#cssutils.css.CSSStyleSheet.cssText" title="cssutils.css.CSSStyleSheet.cssText"><tt class="xref py py-attr docutils literal"><span class="pre">cssText</span></tt></a>. All rules are present in <tt class="xref py py-attr docutils literal"><span class="pre">cssRules</span></tt>, a stylesheet iterates on its rules so this might be easier. Namespaces are available via <a class="reference internal" href="#cssutils.css.CSSStyleSheet.namespaces" title="cssutils.css.CSSStyleSheet.namespaces"><tt class="xref py py-attr docutils literal"><span class="pre">namespaces</span></tt></a> (do not rely on prefixes, see <a class="reference external" href="http://www.w3.org/TR/REC-xml-names/">http://www.w3.org/TR/REC-xml-names/</a> how these work). Variables are available via <a class="reference internal" href="#cssutils.css.CSSStyleSheet.variables" title="cssutils.css.CSSStyleSheet.variables"><tt class="xref py py-attr docutils literal"><span class="pre">variables</span></tt></a> which is a <a class="reference internal" href="#cssutils.css.CSSVariablesDeclaration" title="cssutils.css.CSSVariablesDeclaration"><tt class="xref py py-class docutils literal"><span class="pre">CSSVariablesDeclaration</span></tt></a> and contains <strong>all</strong> available variables including the ones defined in imported style sheets. Changes to this object do NOT change the parent sheet!</p>
61
<dt id="cssutils.css.CSSStyleSheet">
62
<em class="property">class </em><tt class="descclassname">cssutils.css.</tt><tt class="descname">CSSStyleSheet</tt><big>(</big><em>href=None</em>, <em>media=None</em>, <em>title=u''</em>, <em>disabled=None</em>, <em>ownerNode=None</em>, <em>parentStyleSheet=None</em>, <em>readonly=False</em>, <em>ownerRule=None</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSStyleSheet" title="Permalink to this definition">¶</a></dt>
63
<dd><p>CSSStyleSheet represents a CSS style sheet.</p>
65
<div class="highlight-python"><pre>stylesheet
66
: [ CHARSET_SYM S* STRING S* ';' ]?
67
[S|CDO|CDC]* [ import [S|CDO|CDC]* ]*
68
[ namespace [S|CDO|CDC]* ]* # according to @namespace WD
69
[ [ ruleset | media | page ] [S|CDO|CDC]* ]*</pre>
72
<dt><tt class="docutils literal"><span class="pre">cssRules</span></tt></dt>
73
<dd>All Rules in this style sheet, a <a class="reference internal" href="#cssutils.css.CSSRuleList" title="cssutils.css.CSSRuleList"><tt class="xref py py-class docutils literal"><span class="pre">CSSRuleList</span></tt></a>.</dd>
76
<dt id="cssutils.css.CSSStyleSheet.add">
77
<tt class="descname">add</tt><big>(</big><em>rule</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSStyleSheet.add" title="Permalink to this definition">¶</a></dt>
78
<dd><p>Add <cite>rule</cite> to style sheet at appropriate position.
79
Same as <tt class="docutils literal"><span class="pre">insertRule(rule,</span> <span class="pre">inOrder=True)</span></tt>.</p>
82
<dl class="attribute">
83
<dt id="cssutils.css.CSSStyleSheet.alternate">
84
<tt class="descname">alternate</tt><a class="headerlink" href="#cssutils.css.CSSStyleSheet.alternate" title="Permalink to this definition">¶</a></dt>
85
<dd><p>Not used in cssutils yet.</p>
88
<dl class="attribute">
89
<dt id="cssutils.css.CSSStyleSheet.cssText">
90
<tt class="descname">cssText</tt><a class="headerlink" href="#cssutils.css.CSSStyleSheet.cssText" title="Permalink to this definition">¶</a></dt>
91
<dd><p>Textual representation of the stylesheet (a byte string).</p>
95
<dt id="cssutils.css.CSSStyleSheet.deleteRule">
96
<tt class="descname">deleteRule</tt><big>(</big><em>index</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSStyleSheet.deleteRule" title="Permalink to this definition">¶</a></dt>
97
<dd><p>Delete rule at <cite>index</cite> from the style sheet.</p>
98
<table class="docutils field-list" frame="void" rules="none">
99
<col class="field-name" />
100
<col class="field-body" />
102
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
103
<li><strong>index</strong> – <p>The <cite>index</cite> of the rule to be removed from the StyleSheet’s rule
104
list. For an <cite>index</cite> < 0 <strong>no</strong> <a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.IndexSizeErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">IndexSizeErr</span></tt></a> is
105
raised but rules for normal Python lists are used. E.g.
106
<tt class="docutils literal"><span class="pre">deleteRule(-1)</span></tt> removes the last rule in cssRules.</p>
107
<p><cite>index</cite> may also be a CSSRule object which will then be removed
108
from the StyleSheet.</p>
113
<tr class="field"><th class="field-name">Exceptions :</th><td class="field-body"><ul class="first last simple">
114
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.IndexSizeErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">IndexSizeErr</span></tt></a>:
115
Raised if the specified index does not correspond to a rule in
116
the style sheet’s rule list.</li>
117
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.NamespaceErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">NamespaceErr</span></tt></a>:
118
Raised if removing this rule would result in an invalid StyleSheet</li>
119
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.NoModificationAllowedErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">NoModificationAllowedErr</span></tt></a>:
120
Raised if this style sheet is readonly.</li>
128
<dl class="attribute">
129
<dt id="cssutils.css.CSSStyleSheet.encoding">
130
<tt class="descname">encoding</tt><a class="headerlink" href="#cssutils.css.CSSStyleSheet.encoding" title="Permalink to this definition">¶</a></dt>
131
<dd><p>Encoding set in <a class="reference internal" href="#cssutils.css.CSSCharsetRule" title="cssutils.css.CSSCharsetRule"><tt class="xref py py-class docutils literal"><span class="pre">CSSCharsetRule</span></tt></a> or if <tt class="xref docutils literal"><span class="pre">None</span></tt>
132
resulting in default <tt class="docutils literal"><span class="pre">utf-8</span></tt> encoding being used.</p>
135
<dl class="attribute">
136
<dt id="cssutils.css.CSSStyleSheet.href">
137
<tt class="descname">href</tt><a class="headerlink" href="#cssutils.css.CSSStyleSheet.href" title="Permalink to this definition">¶</a></dt>
138
<dd><p>If the style sheet is a linked style sheet, the value of this attribute is its location. For inline style sheets, the value of this attribute is None. See the href attribute definition for the LINK element in HTML 4.0, and the href pseudo-attribute for the XML style sheet processing instruction.</p>
142
<dt id="cssutils.css.CSSStyleSheet.insertRule">
143
<tt class="descname">insertRule</tt><big>(</big><em>rule</em>, <em>index=None</em>, <em>inOrder=False</em>, <em>_clean=True</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSStyleSheet.insertRule" title="Permalink to this definition">¶</a></dt>
144
<dd><p>Used to insert a new rule into the style sheet. The new rule now
145
becomes part of the cascade.</p>
146
<table class="docutils field-list" frame="void" rules="none">
147
<col class="field-name" />
148
<col class="field-body" />
150
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
151
<li><strong>rule</strong> – a parsable DOMString, in cssutils also a
152
<a class="reference internal" href="#cssutils.css.CSSRule" title="cssutils.css.CSSRule"><tt class="xref py py-class docutils literal"><span class="pre">CSSRule</span></tt></a> or <a class="reference internal" href="#cssutils.css.CSSRuleList" title="cssutils.css.CSSRuleList"><tt class="xref py py-class docutils literal"><span class="pre">CSSRuleList</span></tt></a></li>
153
<li><strong>index</strong> – of the rule before the new rule will be inserted.
154
If the specified <cite>index</cite> is equal to the length of the
155
StyleSheet’s rule collection, the rule will be added to the end
157
If <cite>index</cite> is not given or <tt class="xref docutils literal"><span class="pre">None</span></tt> rule will be appended to rule
159
<li><strong>inOrder</strong> – if <tt class="xref docutils literal"><span class="pre">True</span></tt> the rule will be put to a proper location while
160
ignoring <cite>index</cite> and without raising
161
<a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.HierarchyRequestErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">HierarchyRequestErr</span></tt></a>.
162
The resulting index is returned nevertheless.</li>
166
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The index within the style sheet’s rule collection</p>
169
<tr class="field"><th class="field-name">Exceptions :</th><td class="field-body"><ul class="first last simple">
170
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.HierarchyRequestErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">HierarchyRequestErr</span></tt></a>:
171
Raised if the rule cannot be inserted at the specified <cite>index</cite>
172
e.g. if an @import rule is inserted after a standard rule set
173
or other at-rule.</li>
174
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.IndexSizeErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">IndexSizeErr</span></tt></a>:
175
Raised if the specified <cite>index</cite> is not a valid insertion point.</li>
176
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.NoModificationAllowedErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">NoModificationAllowedErr</span></tt></a>:
177
Raised if this style sheet is readonly.</li>
178
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.SyntaxErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">SyntaxErr</span></tt></a>:
179
Raised if the specified rule has a syntax error and is
188
<dl class="attribute">
189
<dt id="cssutils.css.CSSStyleSheet.namespaces">
190
<tt class="descname">namespaces</tt><a class="headerlink" href="#cssutils.css.CSSStyleSheet.namespaces" title="Permalink to this definition">¶</a></dt>
191
<dd><p>All Namespaces used in this CSSStyleSheet.</p>
194
<dl class="attribute">
195
<dt id="cssutils.css.CSSStyleSheet.ownerNode">
196
<tt class="descname">ownerNode</tt><a class="headerlink" href="#cssutils.css.CSSStyleSheet.ownerNode" title="Permalink to this definition">¶</a></dt>
197
<dd><p>Not used in cssutils yet.</p>
200
<dl class="attribute">
201
<dt id="cssutils.css.CSSStyleSheet.ownerRule">
202
<tt class="descname">ownerRule</tt><a class="headerlink" href="#cssutils.css.CSSStyleSheet.ownerRule" title="Permalink to this definition">¶</a></dt>
203
<dd><p>A ref to an @import rule if it is imported, else <tt class="xref docutils literal"><span class="pre">None</span></tt>.</p>
206
<dl class="attribute">
207
<dt id="cssutils.css.CSSStyleSheet.parentStyleSheet">
208
<tt class="descname">parentStyleSheet</tt><a class="headerlink" href="#cssutils.css.CSSStyleSheet.parentStyleSheet" title="Permalink to this definition">¶</a></dt>
209
<dd><p>For style sheet languages that support the concept of style sheet inclusion, this attribute represents the including style sheet, if one exists. If the style sheet is a top-level style sheet, or the style sheet language does not support inclusion, the value of this attribute is None.</p>
212
<dl class="attribute">
213
<dt id="cssutils.css.CSSStyleSheet.seq">
214
<tt class="descname">seq</tt><a class="headerlink" href="#cssutils.css.CSSStyleSheet.seq" title="Permalink to this definition">¶</a></dt>
215
<dd><p>Internal readonly attribute, <strong>DO NOT USE</strong>!</p>
219
<dt id="cssutils.css.CSSStyleSheet.setSerializer">
220
<tt class="descname">setSerializer</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSStyleSheet.setSerializer" title="Permalink to this definition">¶</a></dt>
221
<dd><p>Set the cssutils global Serializer used for all output.</p>
225
<dt id="cssutils.css.CSSStyleSheet.setSerializerPref">
226
<tt class="descname">setSerializerPref</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSStyleSheet.setSerializerPref" title="Permalink to this definition">¶</a></dt>
227
<dd><p>Set a Preference of CSSSerializer used for output.
228
See <a class="reference internal" href="serialize.html#cssutils.serialize.Preferences" title="cssutils.serialize.Preferences"><tt class="xref py py-class docutils literal"><span class="pre">cssutils.serialize.Preferences</span></tt></a> for possible
229
preferences to be set.</p>
232
<dl class="attribute">
233
<dt id="cssutils.css.CSSStyleSheet.type">
234
<tt class="descname">type</tt><a class="headerlink" href="#cssutils.css.CSSStyleSheet.type" title="Permalink to this definition">¶</a></dt>
235
<dd><p>This specifies the style sheet language for this style sheet. The style sheet language is specified as a content type (e.g. <tt class="docutils literal"><span class="pre">text/css</span></tt>). The content type is often specified in the ownerNode. Also see the type attribute definition for the LINK element in HTML 4.0, and the type pseudo-attribute for the XML style sheet processing instruction. For CSS this is always <tt class="docutils literal"><span class="pre">text/css</span></tt>.</p>
238
<dl class="attribute">
239
<dt id="cssutils.css.CSSStyleSheet.variables">
240
<tt class="descname">variables</tt><a class="headerlink" href="#cssutils.css.CSSStyleSheet.variables" title="Permalink to this definition">¶</a></dt>
241
<dd><p>A <a class="reference internal" href="#cssutils.css.CSSVariablesDeclaration" title="cssutils.css.CSSVariablesDeclaration"><tt class="xref py py-class docutils literal"><span class="pre">cssutils.css.CSSVariablesDeclaration</span></tt></a> containing all available variables in this CSSStyleSheet including the ones defined in imported sheets.</p>
247
<div class="section" id="css-rules">
248
<h2>CSS rules<a class="headerlink" href="#css-rules" title="Permalink to this headline">¶</a></h2>
249
<div class="section" id="cssrule">
250
<h3><tt class="docutils literal"><span class="pre">CSSRule</span></tt><a class="headerlink" href="#cssrule" title="Permalink to this headline">¶</a></h3>
252
<dt id="cssutils.css.CSSRule">
253
<em class="property">class </em><tt class="descclassname">cssutils.css.</tt><tt class="descname">CSSRule</tt><big>(</big><em>parentRule=None</em>, <em>parentStyleSheet=None</em>, <em>readonly=False</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSRule" title="Permalink to this definition">¶</a></dt>
254
<dd><p>Abstract base interface for any type of CSS statement. This includes
255
both rule sets and at-rules. An implementation is expected to preserve
256
all rules specified in a CSS style sheet, even if the rule is not
257
recognized by the parser. Unrecognized rules are represented using the
258
<tt class="xref py py-class docutils literal"><span class="pre">CSSUnknownRule</span></tt> interface.</p>
259
<dl class="attribute">
260
<dt id="cssutils.css.CSSRule.CHARSET_RULE">
261
<tt class="descname">CHARSET_RULE</tt><a class="headerlink" href="#cssutils.css.CSSRule.CHARSET_RULE" title="Permalink to this definition">¶</a></dt>
262
<dd><p><a class="reference internal" href="#cssutils.css.CSSCharsetRule" title="cssutils.css.CSSCharsetRule"><tt class="xref py py-class docutils literal"><span class="pre">cssutils.css.CSSCharsetRule</span></tt></a> (not used in CSSOM anymore)</p>
265
<dl class="attribute">
266
<dt id="cssutils.css.CSSRule.COMMENT">
267
<tt class="descname">COMMENT</tt><a class="headerlink" href="#cssutils.css.CSSRule.COMMENT" title="Permalink to this definition">¶</a></dt>
268
<dd><p><a class="reference internal" href="#cssutils.css.CSSComment" title="cssutils.css.CSSComment"><tt class="xref py py-class docutils literal"><span class="pre">cssutils.css.CSSComment</span></tt></a> - not in the offical spec,
269
Value has changed in 0.9.7a3</p>
272
<dl class="attribute">
273
<dt id="cssutils.css.CSSRule.FONT_FACE_RULE">
274
<tt class="descname">FONT_FACE_RULE</tt><a class="headerlink" href="#cssutils.css.CSSRule.FONT_FACE_RULE" title="Permalink to this definition">¶</a></dt>
275
<dd><p><a class="reference internal" href="#cssutils.css.CSSFontFaceRule" title="cssutils.css.CSSFontFaceRule"><tt class="xref py py-class docutils literal"><span class="pre">cssutils.css.CSSFontFaceRule</span></tt></a></p>
278
<dl class="attribute">
279
<dt id="cssutils.css.CSSRule.IMPORT_RULE">
280
<tt class="descname">IMPORT_RULE</tt><a class="headerlink" href="#cssutils.css.CSSRule.IMPORT_RULE" title="Permalink to this definition">¶</a></dt>
281
<dd><p><a class="reference internal" href="#cssutils.css.CSSImportRule" title="cssutils.css.CSSImportRule"><tt class="xref py py-class docutils literal"><span class="pre">cssutils.css.CSSImportRule</span></tt></a></p>
284
<dl class="attribute">
285
<dt id="cssutils.css.CSSRule.MEDIA_RULE">
286
<tt class="descname">MEDIA_RULE</tt><a class="headerlink" href="#cssutils.css.CSSRule.MEDIA_RULE" title="Permalink to this definition">¶</a></dt>
287
<dd><p><a class="reference internal" href="#cssutils.css.CSSMediaRule" title="cssutils.css.CSSMediaRule"><tt class="xref py py-class docutils literal"><span class="pre">cssutils.css.CSSMediaRule</span></tt></a></p>
290
<dl class="attribute">
291
<dt id="cssutils.css.CSSRule.NAMESPACE_RULE">
292
<tt class="descname">NAMESPACE_RULE</tt><a class="headerlink" href="#cssutils.css.CSSRule.NAMESPACE_RULE" title="Permalink to this definition">¶</a></dt>
293
<dd><p><a class="reference internal" href="#cssutils.css.CSSNamespaceRule" title="cssutils.css.CSSNamespaceRule"><tt class="xref py py-class docutils literal"><span class="pre">cssutils.css.CSSNamespaceRule</span></tt></a>,
294
Value has changed in 0.9.7a3 due to a change in the CSSOM spec.</p>
297
<dl class="attribute">
298
<dt id="cssutils.css.CSSRule.PAGE_RULE">
299
<tt class="descname">PAGE_RULE</tt><a class="headerlink" href="#cssutils.css.CSSRule.PAGE_RULE" title="Permalink to this definition">¶</a></dt>
300
<dd><p><a class="reference internal" href="#cssutils.css.CSSPageRule" title="cssutils.css.CSSPageRule"><tt class="xref py py-class docutils literal"><span class="pre">cssutils.css.CSSPageRule</span></tt></a></p>
303
<dl class="attribute">
304
<dt id="cssutils.css.CSSRule.STYLE_RULE">
305
<tt class="descname">STYLE_RULE</tt><a class="headerlink" href="#cssutils.css.CSSRule.STYLE_RULE" title="Permalink to this definition">¶</a></dt>
306
<dd><p><a class="reference internal" href="#cssutils.css.CSSStyleRule" title="cssutils.css.CSSStyleRule"><tt class="xref py py-class docutils literal"><span class="pre">cssutils.css.CSSStyleRule</span></tt></a></p>
309
<dl class="attribute">
310
<dt id="cssutils.css.CSSRule.UNKNOWN_RULE">
311
<tt class="descname">UNKNOWN_RULE</tt><a class="headerlink" href="#cssutils.css.CSSRule.UNKNOWN_RULE" title="Permalink to this definition">¶</a></dt>
312
<dd><p><tt class="xref py py-class docutils literal"><span class="pre">cssutils.css.CSSUnknownRule</span></tt> (not used in CSSOM anymore)</p>
315
<dl class="attribute">
316
<dt id="cssutils.css.CSSRule.VARIABLES_RULE">
317
<tt class="descname">VARIABLES_RULE</tt><a class="headerlink" href="#cssutils.css.CSSRule.VARIABLES_RULE" title="Permalink to this definition">¶</a></dt>
318
<dd><p><a class="reference internal" href="#cssutils.css.CSSVariablesRule" title="cssutils.css.CSSVariablesRule"><tt class="xref py py-class docutils literal"><span class="pre">cssutils.css.CSSVariablesRule</span></tt></a> - experimental rule
319
not in the offical spec</p>
322
<dl class="attribute">
323
<dt id="cssutils.css.CSSRule.atkeyword">
324
<tt class="descname">atkeyword</tt><a class="headerlink" href="#cssutils.css.CSSRule.atkeyword" title="Permalink to this definition">¶</a></dt>
325
<dd><p>Literal keyword of an @rule (e.g. <tt class="docutils literal"><span class="pre">@IMport</span></tt>).</p>
328
<dl class="attribute">
329
<dt id="cssutils.css.CSSRule.cssText">
330
<tt class="descname">cssText</tt><a class="headerlink" href="#cssutils.css.CSSRule.cssText" title="Permalink to this definition">¶</a></dt>
331
<dd><p>(DOM) The parsable textual representation of the rule. This reflects the current state of the rule and not its initial value.</p>
334
<dl class="attribute">
335
<dt id="cssutils.css.CSSRule.parent">
336
<tt class="descname">parent</tt><a class="headerlink" href="#cssutils.css.CSSRule.parent" title="Permalink to this definition">¶</a></dt>
337
<dd><p>The Parent Node of this CSSRule or None.</p>
340
<dl class="attribute">
341
<dt id="cssutils.css.CSSRule.parentRule">
342
<tt class="descname">parentRule</tt><a class="headerlink" href="#cssutils.css.CSSRule.parentRule" title="Permalink to this definition">¶</a></dt>
343
<dd><p>If this rule is contained inside another rule (e.g. a style rule inside an @media block), this is the containing rule. If this rule is not nested inside any other rules, this returns None.</p>
346
<dl class="attribute">
347
<dt id="cssutils.css.CSSRule.parentStyleSheet">
348
<tt class="descname">parentStyleSheet</tt><a class="headerlink" href="#cssutils.css.CSSRule.parentStyleSheet" title="Permalink to this definition">¶</a></dt>
349
<dd><p>The style sheet that contains this rule.</p>
352
<dl class="attribute">
353
<dt id="cssutils.css.CSSRule.seq">
354
<tt class="descname">seq</tt><a class="headerlink" href="#cssutils.css.CSSRule.seq" title="Permalink to this definition">¶</a></dt>
355
<dd><p>Internal readonly attribute, <strong>DO NOT USE</strong>!</p>
358
<dl class="attribute">
359
<dt id="cssutils.css.CSSRule.type">
360
<tt class="descname">type</tt><a class="headerlink" href="#cssutils.css.CSSRule.type" title="Permalink to this definition">¶</a></dt>
361
<dd><p>The type of this rule, as defined by a CSSRule type constant.</p>
364
<dl class="attribute">
365
<dt id="cssutils.css.CSSRule.typeString">
366
<tt class="descname">typeString</tt><a class="headerlink" href="#cssutils.css.CSSRule.typeString" title="Permalink to this definition">¶</a></dt>
367
<dd><p>Descriptive name of this rule’s type.</p>
370
<dl class="attribute">
371
<dt id="cssutils.css.CSSRule.wellformed">
372
<tt class="descname">wellformed</tt><a class="headerlink" href="#cssutils.css.CSSRule.wellformed" title="Permalink to this definition">¶</a></dt>
373
<dd><p>If the rule is wellformed.</p>
379
<div class="section" id="cssrulelist">
380
<h3><tt class="docutils literal"><span class="pre">CSSRuleList</span></tt><a class="headerlink" href="#cssrulelist" title="Permalink to this headline">¶</a></h3>
382
<dt id="cssutils.css.CSSRuleList">
383
<em class="property">class </em><tt class="descclassname">cssutils.css.</tt><tt class="descname">CSSRuleList</tt><big>(</big><em>*ignored</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSRuleList" title="Permalink to this definition">¶</a></dt>
384
<dd><p>The CSSRuleList object represents an (ordered) list of statements.</p>
385
<p>The items in the CSSRuleList are accessible via an integral index,
387
<p>Subclasses a standard Python list so theoretically all standard list
388
methods are available. Setting methods like <tt class="docutils literal"><span class="pre">__init__</span></tt>, <tt class="docutils literal"><span class="pre">append</span></tt>,
389
<tt class="docutils literal"><span class="pre">extend</span></tt> or <tt class="docutils literal"><span class="pre">__setslice__</span></tt> are added later on instances of this
391
E.g. CSSStyleSheet adds <tt class="docutils literal"><span class="pre">append</span></tt> which is not available in a simple
392
instance of this class!</p>
394
<dt id="cssutils.css.CSSRuleList.append">
395
<tt class="descname">append</tt><big>(</big><em>*ignored</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSRuleList.append" title="Permalink to this definition">¶</a></dt>
396
<dd><p>Implemented in class using a CSSRuleList only.</p>
399
<dl class="attribute">
400
<dt id="cssutils.css.CSSRuleList.count">
401
<tt class="descname">count</tt><a class="headerlink" href="#cssutils.css.CSSRuleList.count" title="Permalink to this definition">¶</a></dt>
402
<dd><p>L.count(value) -> integer – return number of occurrences of value</p>
406
<dt id="cssutils.css.CSSRuleList.extend">
407
<tt class="descname">extend</tt><big>(</big><em>*ignored</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSRuleList.extend" title="Permalink to this definition">¶</a></dt>
408
<dd><p>Implemented in class using a CSSRuleList only.</p>
411
<dl class="attribute">
412
<dt id="cssutils.css.CSSRuleList.index">
413
<tt class="descname">index</tt><a class="headerlink" href="#cssutils.css.CSSRuleList.index" title="Permalink to this definition">¶</a></dt>
414
<dd><p>L.index(value, [start, [stop]]) -> integer – return first index of value.
415
Raises ValueError if the value is not present.</p>
418
<dl class="attribute">
419
<dt id="cssutils.css.CSSRuleList.insert">
420
<tt class="descname">insert</tt><a class="headerlink" href="#cssutils.css.CSSRuleList.insert" title="Permalink to this definition">¶</a></dt>
421
<dd><p>L.insert(index, object) – insert object before index</p>
425
<dt id="cssutils.css.CSSRuleList.item">
426
<tt class="descname">item</tt><big>(</big><em>index</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSRuleList.item" title="Permalink to this definition">¶</a></dt>
427
<dd><p>(DOM) Retrieve a CSS rule by ordinal <cite>index</cite>. The order in this
428
collection represents the order of the rules in the CSS style
429
sheet. If index is greater than or equal to the number of rules in
430
the list, this returns None.</p>
431
<p>Returns CSSRule, the style rule at the index position in the
432
CSSRuleList, or None if that is not a valid index.</p>
435
<dl class="attribute">
436
<dt id="cssutils.css.CSSRuleList.length">
437
<tt class="descname">length</tt><a class="headerlink" href="#cssutils.css.CSSRuleList.length" title="Permalink to this definition">¶</a></dt>
438
<dd><p>(DOM) The number of CSSRules in the list.</p>
441
<dl class="attribute">
442
<dt id="cssutils.css.CSSRuleList.pop">
443
<tt class="descname">pop</tt><a class="headerlink" href="#cssutils.css.CSSRuleList.pop" title="Permalink to this definition">¶</a></dt>
444
<dd><p>L.pop([index]) -> item – remove and return item at index (default last).
445
Raises IndexError if list is empty or index is out of range.</p>
448
<dl class="attribute">
449
<dt id="cssutils.css.CSSRuleList.remove">
450
<tt class="descname">remove</tt><a class="headerlink" href="#cssutils.css.CSSRuleList.remove" title="Permalink to this definition">¶</a></dt>
451
<dd><p>L.remove(value) – remove first occurrence of value.
452
Raises ValueError if the value is not present.</p>
455
<dl class="attribute">
456
<dt id="cssutils.css.CSSRuleList.reverse">
457
<tt class="descname">reverse</tt><a class="headerlink" href="#cssutils.css.CSSRuleList.reverse" title="Permalink to this definition">¶</a></dt>
458
<dd><p>L.reverse() – reverse <em>IN PLACE</em></p>
462
<dt id="cssutils.css.CSSRuleList.rulesOfType">
463
<tt class="descname">rulesOfType</tt><big>(</big><em>type</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSRuleList.rulesOfType" title="Permalink to this definition">¶</a></dt>
464
<dd><p>Yield the rules which have the given <cite>type</cite> only, one of the
465
constants defined in <a class="reference internal" href="#cssutils.css.CSSRule" title="cssutils.css.CSSRule"><tt class="xref py py-class docutils literal"><span class="pre">cssutils.css.CSSRule</span></tt></a>.</p>
468
<dl class="attribute">
469
<dt id="cssutils.css.CSSRuleList.sort">
470
<tt class="descname">sort</tt><a class="headerlink" href="#cssutils.css.CSSRuleList.sort" title="Permalink to this definition">¶</a></dt>
471
<dd><p>L.sort(cmp=None, key=None, reverse=False) – stable sort <em>IN PLACE</em>;
472
cmp(x, y) -> -1, 0, 1</p>
478
<div class="section" id="csscharsetrule">
479
<h3><tt class="docutils literal"><span class="pre">CSSCharsetRule</span></tt><a class="headerlink" href="#csscharsetrule" title="Permalink to this headline">¶</a></h3>
481
<dt id="cssutils.css.CSSCharsetRule">
482
<em class="property">class </em><tt class="descclassname">cssutils.css.</tt><tt class="descname">CSSCharsetRule</tt><big>(</big><em>encoding=None</em>, <em>parentRule=None</em>, <em>parentStyleSheet=None</em>, <em>readonly=False</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSCharsetRule" title="Permalink to this definition">¶</a></dt>
483
<dd><p>The CSSCharsetRule interface represents an @charset rule in a CSS style
484
sheet. The value of the encoding attribute does not affect the encoding
485
of text data in the DOM objects; this encoding is always UTF-16
486
(also in Python?). After a stylesheet is loaded, the value of the
487
encoding attribute is the value found in the @charset rule. If there
488
was no @charset in the original document, then no CSSCharsetRule is
489
created. The value of the encoding attribute may also be used as a hint
490
for the encoding used on serialization of the style sheet.</p>
491
<p>The value of the @charset rule (and therefore of the CSSCharsetRule)
492
may not correspond to the encoding the document actually came in;
493
character encoding information e.g. in an HTTP header, has priority
494
(see CSS document representation) but this is not reflected in the
496
<p>This rule is not really needed anymore as setting
497
<a class="reference internal" href="#cssutils.css.CSSStyleSheet.encoding" title="cssutils.css.CSSStyleSheet.encoding"><tt class="xref py py-attr docutils literal"><span class="pre">CSSStyleSheet.encoding</span></tt></a> is much easier.</p>
499
<div class="highlight-python"><pre>charsetrule:
500
CHARSET_SYM S* STRING S* ';'</pre>
502
<p>BUT: Only valid format is (single space, double quotes!):</p>
503
<div class="highlight-python"><pre>@charset "ENCODING";</pre>
505
<dl class="attribute">
506
<dt id="cssutils.css.CSSCharsetRule.atkeyword">
507
<tt class="descname">atkeyword</tt><a class="headerlink" href="#cssutils.css.CSSCharsetRule.atkeyword" title="Permalink to this definition">¶</a></dt>
508
<dd><p>Literal keyword of an @rule (e.g. <tt class="docutils literal"><span class="pre">@IMport</span></tt>).</p>
511
<dl class="attribute">
512
<dt id="cssutils.css.CSSCharsetRule.cssText">
513
<tt class="descname">cssText</tt><a class="headerlink" href="#cssutils.css.CSSCharsetRule.cssText" title="Permalink to this definition">¶</a></dt>
514
<dd><p>(DOM) The parsable textual representation.</p>
517
<dl class="attribute">
518
<dt id="cssutils.css.CSSCharsetRule.encoding">
519
<tt class="descname">encoding</tt><a class="headerlink" href="#cssutils.css.CSSCharsetRule.encoding" title="Permalink to this definition">¶</a></dt>
520
<dd><p>(DOM)The encoding information used in this @charset rule.</p>
523
<dl class="attribute">
524
<dt id="cssutils.css.CSSCharsetRule.parent">
525
<tt class="descname">parent</tt><a class="headerlink" href="#cssutils.css.CSSCharsetRule.parent" title="Permalink to this definition">¶</a></dt>
526
<dd><p>The Parent Node of this CSSRule or None.</p>
529
<dl class="attribute">
530
<dt id="cssutils.css.CSSCharsetRule.parentRule">
531
<tt class="descname">parentRule</tt><a class="headerlink" href="#cssutils.css.CSSCharsetRule.parentRule" title="Permalink to this definition">¶</a></dt>
532
<dd><p>If this rule is contained inside another rule (e.g. a style rule inside an @media block), this is the containing rule. If this rule is not nested inside any other rules, this returns None.</p>
535
<dl class="attribute">
536
<dt id="cssutils.css.CSSCharsetRule.parentStyleSheet">
537
<tt class="descname">parentStyleSheet</tt><a class="headerlink" href="#cssutils.css.CSSCharsetRule.parentStyleSheet" title="Permalink to this definition">¶</a></dt>
538
<dd><p>The style sheet that contains this rule.</p>
541
<dl class="attribute">
542
<dt id="cssutils.css.CSSCharsetRule.seq">
543
<tt class="descname">seq</tt><a class="headerlink" href="#cssutils.css.CSSCharsetRule.seq" title="Permalink to this definition">¶</a></dt>
544
<dd><p>Internal readonly attribute, <strong>DO NOT USE</strong>!</p>
547
<dl class="attribute">
548
<dt id="cssutils.css.CSSCharsetRule.type">
549
<tt class="descname">type</tt><a class="headerlink" href="#cssutils.css.CSSCharsetRule.type" title="Permalink to this definition">¶</a></dt>
550
<dd><p>The type of this rule, as defined by a CSSRule type constant.</p>
553
<dl class="attribute">
554
<dt id="cssutils.css.CSSCharsetRule.typeString">
555
<tt class="descname">typeString</tt><a class="headerlink" href="#cssutils.css.CSSCharsetRule.typeString" title="Permalink to this definition">¶</a></dt>
556
<dd><p>Descriptive name of this rule’s type.</p>
562
<div class="section" id="cssfontfacerule">
563
<h3><tt class="docutils literal"><span class="pre">CSSFontFaceRule</span></tt><a class="headerlink" href="#cssfontfacerule" title="Permalink to this headline">¶</a></h3>
565
<dt id="cssutils.css.CSSFontFaceRule">
566
<em class="property">class </em><tt class="descclassname">cssutils.css.</tt><tt class="descname">CSSFontFaceRule</tt><big>(</big><em>style=None</em>, <em>parentRule=None</em>, <em>parentStyleSheet=None</em>, <em>readonly=False</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSFontFaceRule" title="Permalink to this definition">¶</a></dt>
567
<dd><p>The CSSFontFaceRule interface represents a @font-face rule in a CSS
568
style sheet. The @font-face rule is used to hold a set of font
571
<div class="highlight-python"><pre>font_face
573
'{' S* declaration [ ';' S* declaration ]* '}' S*
576
<p>cssutils uses a <a class="reference internal" href="#cssutils.css.CSSStyleDeclaration" title="cssutils.css.CSSStyleDeclaration"><tt class="xref py py-class docutils literal"><span class="pre">CSSStyleDeclaration</span></tt></a> to
577
represent the font descriptions. For validation a specific profile
578
is used though were some properties have other valid values than
579
when used in e.g. a <a class="reference internal" href="#cssutils.css.CSSStyleRule" title="cssutils.css.CSSStyleRule"><tt class="xref py py-class docutils literal"><span class="pre">CSSStyleRule</span></tt></a>.</p>
580
<dl class="attribute">
581
<dt id="cssutils.css.CSSFontFaceRule.atkeyword">
582
<tt class="descname">atkeyword</tt><a class="headerlink" href="#cssutils.css.CSSFontFaceRule.atkeyword" title="Permalink to this definition">¶</a></dt>
583
<dd><p>Literal keyword of an @rule (e.g. <tt class="docutils literal"><span class="pre">@IMport</span></tt>).</p>
586
<dl class="attribute">
587
<dt id="cssutils.css.CSSFontFaceRule.cssText">
588
<tt class="descname">cssText</tt><a class="headerlink" href="#cssutils.css.CSSFontFaceRule.cssText" title="Permalink to this definition">¶</a></dt>
589
<dd><p>(DOM) The parsable textual representation of this rule.</p>
592
<dl class="attribute">
593
<dt id="cssutils.css.CSSFontFaceRule.parent">
594
<tt class="descname">parent</tt><a class="headerlink" href="#cssutils.css.CSSFontFaceRule.parent" title="Permalink to this definition">¶</a></dt>
595
<dd><p>The Parent Node of this CSSRule or None.</p>
598
<dl class="attribute">
599
<dt id="cssutils.css.CSSFontFaceRule.parentRule">
600
<tt class="descname">parentRule</tt><a class="headerlink" href="#cssutils.css.CSSFontFaceRule.parentRule" title="Permalink to this definition">¶</a></dt>
601
<dd><p>If this rule is contained inside another rule (e.g. a style rule inside an @media block), this is the containing rule. If this rule is not nested inside any other rules, this returns None.</p>
604
<dl class="attribute">
605
<dt id="cssutils.css.CSSFontFaceRule.parentStyleSheet">
606
<tt class="descname">parentStyleSheet</tt><a class="headerlink" href="#cssutils.css.CSSFontFaceRule.parentStyleSheet" title="Permalink to this definition">¶</a></dt>
607
<dd><p>The style sheet that contains this rule.</p>
610
<dl class="attribute">
611
<dt id="cssutils.css.CSSFontFaceRule.seq">
612
<tt class="descname">seq</tt><a class="headerlink" href="#cssutils.css.CSSFontFaceRule.seq" title="Permalink to this definition">¶</a></dt>
613
<dd><p>Internal readonly attribute, <strong>DO NOT USE</strong>!</p>
616
<dl class="attribute">
617
<dt id="cssutils.css.CSSFontFaceRule.style">
618
<tt class="descname">style</tt><a class="headerlink" href="#cssutils.css.CSSFontFaceRule.style" title="Permalink to this definition">¶</a></dt>
619
<dd><p>(DOM) The declaration-block of this rule set, a <a class="reference internal" href="#cssutils.css.CSSStyleDeclaration" title="cssutils.css.CSSStyleDeclaration"><tt class="xref py py-class docutils literal"><span class="pre">CSSStyleDeclaration</span></tt></a>.</p>
622
<dl class="attribute">
623
<dt id="cssutils.css.CSSFontFaceRule.type">
624
<tt class="descname">type</tt><a class="headerlink" href="#cssutils.css.CSSFontFaceRule.type" title="Permalink to this definition">¶</a></dt>
625
<dd><p>The type of this rule, as defined by a CSSRule type constant.</p>
628
<dl class="attribute">
629
<dt id="cssutils.css.CSSFontFaceRule.typeString">
630
<tt class="descname">typeString</tt><a class="headerlink" href="#cssutils.css.CSSFontFaceRule.typeString" title="Permalink to this definition">¶</a></dt>
631
<dd><p>Descriptive name of this rule’s type.</p>
634
<dl class="attribute">
635
<dt id="cssutils.css.CSSFontFaceRule.valid">
636
<tt class="descname">valid</tt><a class="headerlink" href="#cssutils.css.CSSFontFaceRule.valid" title="Permalink to this definition">¶</a></dt>
637
<dd><p>CSSFontFace is valid if properties <cite>font-family</cite> and <cite>src</cite> are set and all properties are valid.</p>
643
<div class="section" id="cssimportrule">
644
<h3><tt class="docutils literal"><span class="pre">CSSImportRule</span></tt><a class="headerlink" href="#cssimportrule" title="Permalink to this headline">¶</a></h3>
646
<dt id="cssutils.css.CSSImportRule">
647
<em class="property">class </em><tt class="descclassname">cssutils.css.</tt><tt class="descname">CSSImportRule</tt><big>(</big><em>href=None</em>, <em>mediaText=None</em>, <em>name=None</em>, <em>parentRule=None</em>, <em>parentStyleSheet=None</em>, <em>readonly=False</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSImportRule" title="Permalink to this definition">¶</a></dt>
648
<dd><p>Represents an @import rule within a CSS style sheet. The @import rule
649
is used to import style rules from other style sheets.</p>
651
<div class="highlight-python"><pre>import
653
[STRING|URI] S* [ medium [ COMMA S* medium]* ]? S* STRING? S* ';' S*
656
<dl class="attribute">
657
<dt id="cssutils.css.CSSImportRule.atkeyword">
658
<tt class="descname">atkeyword</tt><a class="headerlink" href="#cssutils.css.CSSImportRule.atkeyword" title="Permalink to this definition">¶</a></dt>
659
<dd><p>Literal keyword of an @rule (e.g. <tt class="docutils literal"><span class="pre">@IMport</span></tt>).</p>
662
<dl class="attribute">
663
<dt id="cssutils.css.CSSImportRule.cssText">
664
<tt class="descname">cssText</tt><a class="headerlink" href="#cssutils.css.CSSImportRule.cssText" title="Permalink to this definition">¶</a></dt>
665
<dd><p>(DOM) The parsable textual representation of this rule.</p>
668
<dl class="attribute">
669
<dt id="cssutils.css.CSSImportRule.href">
670
<tt class="descname">href</tt><a class="headerlink" href="#cssutils.css.CSSImportRule.href" title="Permalink to this definition">¶</a></dt>
671
<dd><p>Location of the style sheet to be imported.</p>
674
<dl class="attribute">
675
<dt id="cssutils.css.CSSImportRule.media">
676
<tt class="descname">media</tt><a class="headerlink" href="#cssutils.css.CSSImportRule.media" title="Permalink to this definition">¶</a></dt>
677
<dd><p>(DOM) A list of media types for this rule of type <a class="reference internal" href="stylesheets.html#cssutils.stylesheets.MediaList" title="cssutils.stylesheets.MediaList"><tt class="xref py py-class docutils literal"><span class="pre">MediaList</span></tt></a>.</p>
680
<dl class="attribute">
681
<dt id="cssutils.css.CSSImportRule.name">
682
<tt class="descname">name</tt><a class="headerlink" href="#cssutils.css.CSSImportRule.name" title="Permalink to this definition">¶</a></dt>
683
<dd><p>An optional name for the imported sheet.</p>
686
<dl class="attribute">
687
<dt id="cssutils.css.CSSImportRule.parent">
688
<tt class="descname">parent</tt><a class="headerlink" href="#cssutils.css.CSSImportRule.parent" title="Permalink to this definition">¶</a></dt>
689
<dd><p>The Parent Node of this CSSRule or None.</p>
692
<dl class="attribute">
693
<dt id="cssutils.css.CSSImportRule.parentRule">
694
<tt class="descname">parentRule</tt><a class="headerlink" href="#cssutils.css.CSSImportRule.parentRule" title="Permalink to this definition">¶</a></dt>
695
<dd><p>If this rule is contained inside another rule (e.g. a style rule inside an @media block), this is the containing rule. If this rule is not nested inside any other rules, this returns None.</p>
698
<dl class="attribute">
699
<dt id="cssutils.css.CSSImportRule.parentStyleSheet">
700
<tt class="descname">parentStyleSheet</tt><a class="headerlink" href="#cssutils.css.CSSImportRule.parentStyleSheet" title="Permalink to this definition">¶</a></dt>
701
<dd><p>The style sheet that contains this rule.</p>
704
<dl class="attribute">
705
<dt id="cssutils.css.CSSImportRule.seq">
706
<tt class="descname">seq</tt><a class="headerlink" href="#cssutils.css.CSSImportRule.seq" title="Permalink to this definition">¶</a></dt>
707
<dd><p>Internal readonly attribute, <strong>DO NOT USE</strong>!</p>
710
<dl class="attribute">
711
<dt id="cssutils.css.CSSImportRule.styleSheet">
712
<tt class="descname">styleSheet</tt><a class="headerlink" href="#cssutils.css.CSSImportRule.styleSheet" title="Permalink to this definition">¶</a></dt>
713
<dd><p>(readonly) The style sheet referred to by this rule.</p>
716
<dl class="attribute">
717
<dt id="cssutils.css.CSSImportRule.type">
718
<tt class="descname">type</tt><a class="headerlink" href="#cssutils.css.CSSImportRule.type" title="Permalink to this definition">¶</a></dt>
719
<dd><p>The type of this rule, as defined by a CSSRule type constant.</p>
722
<dl class="attribute">
723
<dt id="cssutils.css.CSSImportRule.typeString">
724
<tt class="descname">typeString</tt><a class="headerlink" href="#cssutils.css.CSSImportRule.typeString" title="Permalink to this definition">¶</a></dt>
725
<dd><p>Descriptive name of this rule’s type.</p>
728
<dl class="attribute">
729
<dt id="cssutils.css.CSSImportRule.wellformed">
730
<tt class="descname">wellformed</tt><a class="headerlink" href="#cssutils.css.CSSImportRule.wellformed" title="Permalink to this definition">¶</a></dt>
731
<dd><p>Depending on if media is used at all.</p>
737
<div class="section" id="cssmediarule">
738
<h3><tt class="docutils literal"><span class="pre">CSSMediaRule</span></tt><a class="headerlink" href="#cssmediarule" title="Permalink to this headline">¶</a></h3>
740
<dt id="cssutils.css.CSSMediaRule">
741
<em class="property">class </em><tt class="descclassname">cssutils.css.</tt><tt class="descname">CSSMediaRule</tt><big>(</big><em>mediaText='all'</em>, <em>name=None</em>, <em>parentRule=None</em>, <em>parentStyleSheet=None</em>, <em>readonly=False</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSMediaRule" title="Permalink to this definition">¶</a></dt>
742
<dd><p>Objects implementing the CSSMediaRule interface can be identified by the
743
MEDIA_RULE constant. On these objects the type attribute must return the
744
value of that constant.</p>
746
<div class="highlight-python"><pre>: MEDIA_SYM S* medium [ COMMA S* medium ]*
750
LBRACE S* ruleset* '}' S*;</pre>
752
<dl class="docutils">
753
<dt><tt class="docutils literal"><span class="pre">cssRules</span></tt></dt>
754
<dd>All Rules in this media rule, a <a class="reference internal" href="#cssutils.css.CSSRuleList" title="cssutils.css.CSSRuleList"><tt class="xref py py-class docutils literal"><span class="pre">CSSRuleList</span></tt></a>.</dd>
757
<dt id="cssutils.css.CSSMediaRule.add">
758
<tt class="descname">add</tt><big>(</big><em>rule</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSMediaRule.add" title="Permalink to this definition">¶</a></dt>
759
<dd><p>Add <cite>rule</cite> to end of this mediarule.
760
Same as <a class="reference internal" href="#cssutils.css.CSSMediaRule.insertRule" title="cssutils.css.CSSMediaRule.insertRule"><tt class="xref py py-meth docutils literal"><span class="pre">insertRule()</span></tt></a>.</p>
763
<dl class="attribute">
764
<dt id="cssutils.css.CSSMediaRule.atkeyword">
765
<tt class="descname">atkeyword</tt><a class="headerlink" href="#cssutils.css.CSSMediaRule.atkeyword" title="Permalink to this definition">¶</a></dt>
766
<dd><p>Literal keyword of an @rule (e.g. <tt class="docutils literal"><span class="pre">@IMport</span></tt>).</p>
769
<dl class="attribute">
770
<dt id="cssutils.css.CSSMediaRule.cssText">
771
<tt class="descname">cssText</tt><a class="headerlink" href="#cssutils.css.CSSMediaRule.cssText" title="Permalink to this definition">¶</a></dt>
772
<dd><p>(DOM) The parsable textual representation of this rule.</p>
776
<dt id="cssutils.css.CSSMediaRule.deleteRule">
777
<tt class="descname">deleteRule</tt><big>(</big><em>index</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSMediaRule.deleteRule" title="Permalink to this definition">¶</a></dt>
778
<dd><p>Delete the rule at <cite>index</cite> from the media block.</p>
779
<table class="docutils field-list" frame="void" rules="none">
780
<col class="field-name" />
781
<col class="field-body" />
783
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
784
<li><strong>index</strong> – <p>The <cite>index</cite> of the rule to be removed from the media block’s rule
785
list. For an <cite>index</cite> < 0 <strong>no</strong> <a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.IndexSizeErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">IndexSizeErr</span></tt></a> is
786
raised but rules for normal Python lists are used. E.g.
787
<tt class="docutils literal"><span class="pre">deleteRule(-1)</span></tt> removes the last rule in cssRules.</p>
788
<p><cite>index</cite> may also be a CSSRule object which will then be removed
789
from the media block.</p>
794
<tr class="field"><th class="field-name">Exceptions :</th><td class="field-body"><ul class="first last simple">
795
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.IndexSizeErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">IndexSizeErr</span></tt></a>:
796
Raised if the specified index does not correspond to a rule in
797
the media rule list.</li>
798
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.NoModificationAllowedErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">NoModificationAllowedErr</span></tt></a>:
799
Raised if this media rule is readonly.</li>
808
<dt id="cssutils.css.CSSMediaRule.insertRule">
809
<tt class="descname">insertRule</tt><big>(</big><em>rule</em>, <em>index=None</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSMediaRule.insertRule" title="Permalink to this definition">¶</a></dt>
810
<dd><p>Insert <cite>rule</cite> into the media block.</p>
811
<table class="docutils field-list" frame="void" rules="none">
812
<col class="field-name" />
813
<col class="field-body" />
815
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
816
<li><strong>rule</strong> – <p>the parsable text representing the <cite>rule</cite> to be inserted. For rule
817
sets this contains both the selector and the style declaration.
818
For at-rules, this specifies both the at-identifier and the rule
820
<p>cssutils also allows rule to be a valid
821
<a class="reference internal" href="#cssutils.css.CSSRule" title="cssutils.css.CSSRule"><tt class="xref py py-class docutils literal"><span class="pre">CSSRule</span></tt></a> object.</p>
823
<li><strong>index</strong> – before the specified <cite>rule</cite> will be inserted.
824
If the specified <cite>index</cite> is
825
equal to the length of the media blocks’s rule collection, the
826
rule will be added to the end of the media block.
827
If index is not given or None rule will be appended to rule
832
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the index within the media block’s rule collection of the
833
newly inserted rule.</p>
836
<tr class="field"><th class="field-name">Exceptions :</th><td class="field-body"><ul class="first last simple">
837
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.HierarchyRequestErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">HierarchyRequestErr</span></tt></a>:
838
Raised if the <cite>rule</cite> cannot be inserted at the specified <cite>index</cite>,
839
e.g., if an @import rule is inserted after a standard rule set
840
or other at-rule.</li>
841
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.IndexSizeErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">IndexSizeErr</span></tt></a>:
842
Raised if the specified <cite>index</cite> is not a valid insertion point.</li>
843
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.NoModificationAllowedErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">NoModificationAllowedErr</span></tt></a>:
844
Raised if this media rule is readonly.</li>
845
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.SyntaxErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">SyntaxErr</span></tt></a>:
846
Raised if the specified <cite>rule</cite> has a syntax error and is
855
<dl class="attribute">
856
<dt id="cssutils.css.CSSMediaRule.media">
857
<tt class="descname">media</tt><a class="headerlink" href="#cssutils.css.CSSMediaRule.media" title="Permalink to this definition">¶</a></dt>
858
<dd><p>(DOM) A list of media types for this rule of type <a class="reference internal" href="stylesheets.html#cssutils.stylesheets.MediaList" title="cssutils.stylesheets.MediaList"><tt class="xref py py-class docutils literal"><span class="pre">MediaList</span></tt></a>.</p>
861
<dl class="attribute">
862
<dt id="cssutils.css.CSSMediaRule.name">
863
<tt class="descname">name</tt><a class="headerlink" href="#cssutils.css.CSSMediaRule.name" title="Permalink to this definition">¶</a></dt>
864
<dd><p>An optional name for this media rule.</p>
867
<dl class="attribute">
868
<dt id="cssutils.css.CSSMediaRule.parent">
869
<tt class="descname">parent</tt><a class="headerlink" href="#cssutils.css.CSSMediaRule.parent" title="Permalink to this definition">¶</a></dt>
870
<dd><p>The Parent Node of this CSSRule or None.</p>
873
<dl class="attribute">
874
<dt id="cssutils.css.CSSMediaRule.parentRule">
875
<tt class="descname">parentRule</tt><a class="headerlink" href="#cssutils.css.CSSMediaRule.parentRule" title="Permalink to this definition">¶</a></dt>
876
<dd><p>If this rule is contained inside another rule (e.g. a style rule inside an @media block), this is the containing rule. If this rule is not nested inside any other rules, this returns None.</p>
879
<dl class="attribute">
880
<dt id="cssutils.css.CSSMediaRule.parentStyleSheet">
881
<tt class="descname">parentStyleSheet</tt><a class="headerlink" href="#cssutils.css.CSSMediaRule.parentStyleSheet" title="Permalink to this definition">¶</a></dt>
882
<dd><p>The style sheet that contains this rule.</p>
885
<dl class="attribute">
886
<dt id="cssutils.css.CSSMediaRule.seq">
887
<tt class="descname">seq</tt><a class="headerlink" href="#cssutils.css.CSSMediaRule.seq" title="Permalink to this definition">¶</a></dt>
888
<dd><p>Internal readonly attribute, <strong>DO NOT USE</strong>!</p>
891
<dl class="attribute">
892
<dt id="cssutils.css.CSSMediaRule.type">
893
<tt class="descname">type</tt><a class="headerlink" href="#cssutils.css.CSSMediaRule.type" title="Permalink to this definition">¶</a></dt>
894
<dd><p>The type of this rule, as defined by a CSSRule type constant.</p>
897
<dl class="attribute">
898
<dt id="cssutils.css.CSSMediaRule.typeString">
899
<tt class="descname">typeString</tt><a class="headerlink" href="#cssutils.css.CSSMediaRule.typeString" title="Permalink to this definition">¶</a></dt>
900
<dd><p>Descriptive name of this rule’s type.</p>
906
<div class="section" id="cssnamespacerule">
907
<h3><tt class="docutils literal"><span class="pre">CSSNamespaceRule</span></tt><a class="headerlink" href="#cssnamespacerule" title="Permalink to this headline">¶</a></h3>
909
<dt id="cssutils.css.CSSNamespaceRule">
910
<em class="property">class </em><tt class="descclassname">cssutils.css.</tt><tt class="descname">CSSNamespaceRule</tt><big>(</big><em>namespaceURI=None</em>, <em>prefix=None</em>, <em>cssText=None</em>, <em>parentRule=None</em>, <em>parentStyleSheet=None</em>, <em>readonly=False</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSNamespaceRule" title="Permalink to this definition">¶</a></dt>
911
<dd><p>Represents an @namespace rule within a CSS style sheet.</p>
912
<p>The @namespace at-rule declares a namespace prefix and associates
913
it with a given namespace (a string). This namespace prefix can then be
914
used in namespace-qualified names such as those described in the
915
Selectors Module [SELECT] or the Values and Units module [CSS3VAL].</p>
916
<p>Dealing with these rules directly is not needed anymore, easier is
917
the use of <a class="reference internal" href="#cssutils.css.CSSStyleSheet.namespaces" title="cssutils.css.CSSStyleSheet.namespaces"><tt class="xref py py-attr docutils literal"><span class="pre">cssutils.css.CSSStyleSheet.namespaces</span></tt></a>.</p>
919
<div class="highlight-python"><pre>namespace
920
: NAMESPACE_SYM S* [namespace_prefix S*]? [STRING|URI] S* ';' S*
926
<dl class="attribute">
927
<dt id="cssutils.css.CSSNamespaceRule.atkeyword">
928
<tt class="descname">atkeyword</tt><a class="headerlink" href="#cssutils.css.CSSNamespaceRule.atkeyword" title="Permalink to this definition">¶</a></dt>
929
<dd><p>Literal keyword of an @rule (e.g. <tt class="docutils literal"><span class="pre">@IMport</span></tt>).</p>
932
<dl class="attribute">
933
<dt id="cssutils.css.CSSNamespaceRule.cssText">
934
<tt class="descname">cssText</tt><a class="headerlink" href="#cssutils.css.CSSNamespaceRule.cssText" title="Permalink to this definition">¶</a></dt>
935
<dd><p>(DOM) The parsable textual representation of this rule.</p>
938
<dl class="attribute">
939
<dt id="cssutils.css.CSSNamespaceRule.namespaceURI">
940
<tt class="descname">namespaceURI</tt><a class="headerlink" href="#cssutils.css.CSSNamespaceRule.namespaceURI" title="Permalink to this definition">¶</a></dt>
941
<dd><p>URI (handled as simple string) of the defined namespace.</p>
944
<dl class="attribute">
945
<dt id="cssutils.css.CSSNamespaceRule.parent">
946
<tt class="descname">parent</tt><a class="headerlink" href="#cssutils.css.CSSNamespaceRule.parent" title="Permalink to this definition">¶</a></dt>
947
<dd><p>The Parent Node of this CSSRule or None.</p>
950
<dl class="attribute">
951
<dt id="cssutils.css.CSSNamespaceRule.parentRule">
952
<tt class="descname">parentRule</tt><a class="headerlink" href="#cssutils.css.CSSNamespaceRule.parentRule" title="Permalink to this definition">¶</a></dt>
953
<dd><p>If this rule is contained inside another rule (e.g. a style rule inside an @media block), this is the containing rule. If this rule is not nested inside any other rules, this returns None.</p>
956
<dl class="attribute">
957
<dt id="cssutils.css.CSSNamespaceRule.parentStyleSheet">
958
<tt class="descname">parentStyleSheet</tt><a class="headerlink" href="#cssutils.css.CSSNamespaceRule.parentStyleSheet" title="Permalink to this definition">¶</a></dt>
959
<dd><p>The style sheet that contains this rule.</p>
962
<dl class="attribute">
963
<dt id="cssutils.css.CSSNamespaceRule.prefix">
964
<tt class="descname">prefix</tt><a class="headerlink" href="#cssutils.css.CSSNamespaceRule.prefix" title="Permalink to this definition">¶</a></dt>
965
<dd><p>Prefix used for the defined namespace.</p>
968
<dl class="attribute">
969
<dt id="cssutils.css.CSSNamespaceRule.seq">
970
<tt class="descname">seq</tt><a class="headerlink" href="#cssutils.css.CSSNamespaceRule.seq" title="Permalink to this definition">¶</a></dt>
971
<dd><p>Internal readonly attribute, <strong>DO NOT USE</strong>!</p>
974
<dl class="attribute">
975
<dt id="cssutils.css.CSSNamespaceRule.type">
976
<tt class="descname">type</tt><a class="headerlink" href="#cssutils.css.CSSNamespaceRule.type" title="Permalink to this definition">¶</a></dt>
977
<dd><p>The type of this rule, as defined by a CSSRule type constant.</p>
980
<dl class="attribute">
981
<dt id="cssutils.css.CSSNamespaceRule.typeString">
982
<tt class="descname">typeString</tt><a class="headerlink" href="#cssutils.css.CSSNamespaceRule.typeString" title="Permalink to this definition">¶</a></dt>
983
<dd><p>Descriptive name of this rule’s type.</p>
989
<div class="section" id="csspagerule">
990
<h3><tt class="docutils literal"><span class="pre">CSSPageRule</span></tt><a class="headerlink" href="#csspagerule" title="Permalink to this headline">¶</a></h3>
992
<dt id="cssutils.css.CSSPageRule">
993
<em class="property">class </em><tt class="descclassname">cssutils.css.</tt><tt class="descname">CSSPageRule</tt><big>(</big><em>selectorText=None</em>, <em>style=None</em>, <em>parentRule=None</em>, <em>parentStyleSheet=None</em>, <em>readonly=False</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSPageRule" title="Permalink to this definition">¶</a></dt>
994
<dd><p>The CSSPageRule interface represents a @page rule within a CSS style
995
sheet. The @page rule is used to specify the dimensions, orientation,
996
margins, etc. of a page box for paged media.</p>
998
<div class="highlight-python"><pre>page
999
PAGE_SYM S* IDENT? pseudo_page? S*
1000
'{' S* declaration [ ';' S* declaration ]* '}' S*
1003
':' [ "left" | "right" | "first" ]
1006
<dl class="attribute">
1007
<dt id="cssutils.css.CSSPageRule.atkeyword">
1008
<tt class="descname">atkeyword</tt><a class="headerlink" href="#cssutils.css.CSSPageRule.atkeyword" title="Permalink to this definition">¶</a></dt>
1009
<dd><p>Literal keyword of an @rule (e.g. <tt class="docutils literal"><span class="pre">@IMport</span></tt>).</p>
1012
<dl class="attribute">
1013
<dt id="cssutils.css.CSSPageRule.cssText">
1014
<tt class="descname">cssText</tt><a class="headerlink" href="#cssutils.css.CSSPageRule.cssText" title="Permalink to this definition">¶</a></dt>
1015
<dd><p>(DOM) The parsable textual representation of this rule.</p>
1018
<dl class="attribute">
1019
<dt id="cssutils.css.CSSPageRule.parent">
1020
<tt class="descname">parent</tt><a class="headerlink" href="#cssutils.css.CSSPageRule.parent" title="Permalink to this definition">¶</a></dt>
1021
<dd><p>The Parent Node of this CSSRule or None.</p>
1024
<dl class="attribute">
1025
<dt id="cssutils.css.CSSPageRule.parentRule">
1026
<tt class="descname">parentRule</tt><a class="headerlink" href="#cssutils.css.CSSPageRule.parentRule" title="Permalink to this definition">¶</a></dt>
1027
<dd><p>If this rule is contained inside another rule (e.g. a style rule inside an @media block), this is the containing rule. If this rule is not nested inside any other rules, this returns None.</p>
1030
<dl class="attribute">
1031
<dt id="cssutils.css.CSSPageRule.parentStyleSheet">
1032
<tt class="descname">parentStyleSheet</tt><a class="headerlink" href="#cssutils.css.CSSPageRule.parentStyleSheet" title="Permalink to this definition">¶</a></dt>
1033
<dd><p>The style sheet that contains this rule.</p>
1036
<dl class="attribute">
1037
<dt id="cssutils.css.CSSPageRule.selectorText">
1038
<tt class="descname">selectorText</tt><a class="headerlink" href="#cssutils.css.CSSPageRule.selectorText" title="Permalink to this definition">¶</a></dt>
1039
<dd><p>(DOM) The parsable textual representation of the page selector for the rule.</p>
1042
<dl class="attribute">
1043
<dt id="cssutils.css.CSSPageRule.seq">
1044
<tt class="descname">seq</tt><a class="headerlink" href="#cssutils.css.CSSPageRule.seq" title="Permalink to this definition">¶</a></dt>
1045
<dd><p>Internal readonly attribute, <strong>DO NOT USE</strong>!</p>
1048
<dl class="attribute">
1049
<dt id="cssutils.css.CSSPageRule.style">
1050
<tt class="descname">style</tt><a class="headerlink" href="#cssutils.css.CSSPageRule.style" title="Permalink to this definition">¶</a></dt>
1051
<dd><p>(DOM) The declaration-block of this rule set, a <a class="reference internal" href="#cssutils.css.CSSStyleDeclaration" title="cssutils.css.CSSStyleDeclaration"><tt class="xref py py-class docutils literal"><span class="pre">CSSStyleDeclaration</span></tt></a>.</p>
1054
<dl class="attribute">
1055
<dt id="cssutils.css.CSSPageRule.type">
1056
<tt class="descname">type</tt><a class="headerlink" href="#cssutils.css.CSSPageRule.type" title="Permalink to this definition">¶</a></dt>
1057
<dd><p>The type of this rule, as defined by a CSSRule type constant.</p>
1060
<dl class="attribute">
1061
<dt id="cssutils.css.CSSPageRule.typeString">
1062
<tt class="descname">typeString</tt><a class="headerlink" href="#cssutils.css.CSSPageRule.typeString" title="Permalink to this definition">¶</a></dt>
1063
<dd><p>Descriptive name of this rule’s type.</p>
1069
<div class="section" id="cssstylerule">
1070
<h3><tt class="docutils literal"><span class="pre">CSSStyleRule</span></tt><a class="headerlink" href="#cssstylerule" title="Permalink to this headline">¶</a></h3>
1072
<dt id="cssutils.css.CSSStyleRule">
1073
<em class="property">class </em><tt class="descclassname">cssutils.css.</tt><tt class="descname">CSSStyleRule</tt><big>(</big><em>selectorText=None</em>, <em>style=None</em>, <em>parentRule=None</em>, <em>parentStyleSheet=None</em>, <em>readonly=False</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSStyleRule" title="Permalink to this definition">¶</a></dt>
1074
<dd><p>The CSSStyleRule object represents a ruleset specified (if any) in a CSS
1075
style sheet. It provides access to a declaration block as well as to the
1076
associated group of selectors.</p>
1078
<div class="highlight-python"><pre>: selector [ COMMA S* selector ]*
1079
LBRACE S* declaration [ ';' S* declaration ]* '}' S*
1082
<dl class="attribute">
1083
<dt id="cssutils.css.CSSStyleRule.atkeyword">
1084
<tt class="descname">atkeyword</tt><a class="headerlink" href="#cssutils.css.CSSStyleRule.atkeyword" title="Permalink to this definition">¶</a></dt>
1085
<dd><p>Literal keyword of an @rule (e.g. <tt class="docutils literal"><span class="pre">@IMport</span></tt>).</p>
1088
<dl class="attribute">
1089
<dt id="cssutils.css.CSSStyleRule.cssText">
1090
<tt class="descname">cssText</tt><a class="headerlink" href="#cssutils.css.CSSStyleRule.cssText" title="Permalink to this definition">¶</a></dt>
1091
<dd><p>(DOM) The parsable textual representation of this rule.</p>
1094
<dl class="attribute">
1095
<dt id="cssutils.css.CSSStyleRule.parent">
1096
<tt class="descname">parent</tt><a class="headerlink" href="#cssutils.css.CSSStyleRule.parent" title="Permalink to this definition">¶</a></dt>
1097
<dd><p>The Parent Node of this CSSRule or None.</p>
1100
<dl class="attribute">
1101
<dt id="cssutils.css.CSSStyleRule.parentRule">
1102
<tt class="descname">parentRule</tt><a class="headerlink" href="#cssutils.css.CSSStyleRule.parentRule" title="Permalink to this definition">¶</a></dt>
1103
<dd><p>If this rule is contained inside another rule (e.g. a style rule inside an @media block), this is the containing rule. If this rule is not nested inside any other rules, this returns None.</p>
1106
<dl class="attribute">
1107
<dt id="cssutils.css.CSSStyleRule.parentStyleSheet">
1108
<tt class="descname">parentStyleSheet</tt><a class="headerlink" href="#cssutils.css.CSSStyleRule.parentStyleSheet" title="Permalink to this definition">¶</a></dt>
1109
<dd><p>The style sheet that contains this rule.</p>
1112
<dl class="attribute">
1113
<dt id="cssutils.css.CSSStyleRule.selectorList">
1114
<tt class="descname">selectorList</tt><a class="headerlink" href="#cssutils.css.CSSStyleRule.selectorList" title="Permalink to this definition">¶</a></dt>
1115
<dd><p>The SelectorList of this rule.</p>
1118
<dl class="attribute">
1119
<dt id="cssutils.css.CSSStyleRule.selectorText">
1120
<tt class="descname">selectorText</tt><a class="headerlink" href="#cssutils.css.CSSStyleRule.selectorText" title="Permalink to this definition">¶</a></dt>
1121
<dd><p>(DOM) The textual representation of the selector for the rule set.</p>
1124
<dl class="attribute">
1125
<dt id="cssutils.css.CSSStyleRule.seq">
1126
<tt class="descname">seq</tt><a class="headerlink" href="#cssutils.css.CSSStyleRule.seq" title="Permalink to this definition">¶</a></dt>
1127
<dd><p>Internal readonly attribute, <strong>DO NOT USE</strong>!</p>
1130
<dl class="attribute">
1131
<dt id="cssutils.css.CSSStyleRule.style">
1132
<tt class="descname">style</tt><a class="headerlink" href="#cssutils.css.CSSStyleRule.style" title="Permalink to this definition">¶</a></dt>
1133
<dd><p>(DOM) The declaration-block of this rule set.</p>
1136
<dl class="attribute">
1137
<dt id="cssutils.css.CSSStyleRule.type">
1138
<tt class="descname">type</tt><a class="headerlink" href="#cssutils.css.CSSStyleRule.type" title="Permalink to this definition">¶</a></dt>
1139
<dd><p>The type of this rule, as defined by a CSSRule type constant.</p>
1142
<dl class="attribute">
1143
<dt id="cssutils.css.CSSStyleRule.typeString">
1144
<tt class="descname">typeString</tt><a class="headerlink" href="#cssutils.css.CSSStyleRule.typeString" title="Permalink to this definition">¶</a></dt>
1145
<dd><p>Descriptive name of this rule’s type.</p>
1151
<div class="section" id="cssvariablesrule">
1152
<h3><tt class="docutils literal"><span class="pre">CSSVariablesRule</span></tt><a class="headerlink" href="#cssvariablesrule" title="Permalink to this headline">¶</a></h3>
1154
<dt id="cssutils.css.CSSVariablesRule">
1155
<em class="property">class </em><tt class="descclassname">cssutils.css.</tt><tt class="descname">CSSVariablesRule</tt><big>(</big><em>mediaText=None</em>, <em>variables=None</em>, <em>parentRule=None</em>, <em>parentStyleSheet=None</em>, <em>readonly=False</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSVariablesRule" title="Permalink to this definition">¶</a></dt>
1156
<dd><p>The CSSVariablesRule interface represents a @variables rule within a CSS
1157
style sheet. The @variables rule is used to specify variables.</p>
1158
<p>cssutils uses a <a class="reference internal" href="#cssutils.css.CSSVariablesDeclaration" title="cssutils.css.CSSVariablesDeclaration"><tt class="xref py py-class docutils literal"><span class="pre">CSSVariablesDeclaration</span></tt></a> to
1159
represent the variables.</p>
1161
<div class="highlight-python"><pre>variables
1162
VARIABLES_SYM S* medium [ COMMA S* medium ]* LBRACE S*
1166
<p>for variableset see <a class="reference internal" href="#cssutils.css.CSSVariablesDeclaration" title="cssutils.css.CSSVariablesDeclaration"><tt class="xref py py-class docutils literal"><span class="pre">cssutils.css.CSSVariablesDeclaration</span></tt></a></p>
1167
<p><strong>Media are not implemented. Reason is that cssutils is using CSS
1168
variables in a kind of preprocessing and therefor no media information
1169
is available at this stage. For now do not use media!</strong></p>
1171
<div class="highlight-python"><pre>@variables {
1172
CorporateLogoBGColor: #fe8d12;
1176
background-color: var(CorporateLogoBGColor);
1179
<dl class="attribute">
1180
<dt id="cssutils.css.CSSVariablesRule.atkeyword">
1181
<tt class="descname">atkeyword</tt><a class="headerlink" href="#cssutils.css.CSSVariablesRule.atkeyword" title="Permalink to this definition">¶</a></dt>
1182
<dd><p>Literal keyword of an @rule (e.g. <tt class="docutils literal"><span class="pre">@IMport</span></tt>).</p>
1185
<dl class="attribute">
1186
<dt id="cssutils.css.CSSVariablesRule.cssText">
1187
<tt class="descname">cssText</tt><a class="headerlink" href="#cssutils.css.CSSVariablesRule.cssText" title="Permalink to this definition">¶</a></dt>
1188
<dd><p>(DOM) The parsable textual representation of this rule.</p>
1191
<dl class="attribute">
1192
<dt id="cssutils.css.CSSVariablesRule.media">
1193
<tt class="descname">media</tt><a class="headerlink" href="#cssutils.css.CSSVariablesRule.media" title="Permalink to this definition">¶</a></dt>
1194
<dd><p>NOT IMPLEMENTED! As cssutils resolves variables during serializing media information is lost.</p>
1197
<dl class="attribute">
1198
<dt id="cssutils.css.CSSVariablesRule.parent">
1199
<tt class="descname">parent</tt><a class="headerlink" href="#cssutils.css.CSSVariablesRule.parent" title="Permalink to this definition">¶</a></dt>
1200
<dd><p>The Parent Node of this CSSRule or None.</p>
1203
<dl class="attribute">
1204
<dt id="cssutils.css.CSSVariablesRule.parentRule">
1205
<tt class="descname">parentRule</tt><a class="headerlink" href="#cssutils.css.CSSVariablesRule.parentRule" title="Permalink to this definition">¶</a></dt>
1206
<dd><p>If this rule is contained inside another rule (e.g. a style rule inside an @media block), this is the containing rule. If this rule is not nested inside any other rules, this returns None.</p>
1209
<dl class="attribute">
1210
<dt id="cssutils.css.CSSVariablesRule.parentStyleSheet">
1211
<tt class="descname">parentStyleSheet</tt><a class="headerlink" href="#cssutils.css.CSSVariablesRule.parentStyleSheet" title="Permalink to this definition">¶</a></dt>
1212
<dd><p>The style sheet that contains this rule.</p>
1215
<dl class="attribute">
1216
<dt id="cssutils.css.CSSVariablesRule.seq">
1217
<tt class="descname">seq</tt><a class="headerlink" href="#cssutils.css.CSSVariablesRule.seq" title="Permalink to this definition">¶</a></dt>
1218
<dd><p>Internal readonly attribute, <strong>DO NOT USE</strong>!</p>
1221
<dl class="attribute">
1222
<dt id="cssutils.css.CSSVariablesRule.type">
1223
<tt class="descname">type</tt><a class="headerlink" href="#cssutils.css.CSSVariablesRule.type" title="Permalink to this definition">¶</a></dt>
1224
<dd><p>The type of this rule, as defined by a CSSRule type constant.</p>
1227
<dl class="attribute">
1228
<dt id="cssutils.css.CSSVariablesRule.typeString">
1229
<tt class="descname">typeString</tt><a class="headerlink" href="#cssutils.css.CSSVariablesRule.typeString" title="Permalink to this definition">¶</a></dt>
1230
<dd><p>Descriptive name of this rule’s type.</p>
1233
<dl class="attribute">
1234
<dt id="cssutils.css.CSSVariablesRule.valid">
1235
<tt class="descname">valid</tt><a class="headerlink" href="#cssutils.css.CSSVariablesRule.valid" title="Permalink to this definition">¶</a></dt>
1236
<dd><p>NOT IMPLEMTED REALLY (TODO)</p>
1239
<dl class="attribute">
1240
<dt id="cssutils.css.CSSVariablesRule.variables">
1241
<tt class="descname">variables</tt><a class="headerlink" href="#cssutils.css.CSSVariablesRule.variables" title="Permalink to this definition">¶</a></dt>
1242
<dd><p>(DOM) The variables of this rule set, a <a class="reference internal" href="#cssutils.css.CSSVariablesDeclaration" title="cssutils.css.CSSVariablesDeclaration"><tt class="xref py py-class docutils literal"><span class="pre">cssutils.css.CSSVariablesDeclaration</span></tt></a>.</p>
1248
<div class="section" id="csscomment">
1249
<h3><tt class="docutils literal"><span class="pre">CSSComment</span></tt><a class="headerlink" href="#csscomment" title="Permalink to this headline">¶</a></h3>
1251
<dt id="cssutils.css.CSSComment">
1252
<em class="property">class </em><tt class="descclassname">cssutils.css.</tt><tt class="descname">CSSComment</tt><big>(</big><em>cssText=None</em>, <em>parentRule=None</em>, <em>parentStyleSheet=None</em>, <em>readonly=False</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSComment" title="Permalink to this definition">¶</a></dt>
1253
<dd><p>Represents a CSS comment (cssutils only).</p>
1255
<div class="highlight-python"><pre>/*...*/</pre>
1257
<dl class="attribute">
1258
<dt id="cssutils.css.CSSComment.atkeyword">
1259
<tt class="descname">atkeyword</tt><a class="headerlink" href="#cssutils.css.CSSComment.atkeyword" title="Permalink to this definition">¶</a></dt>
1260
<dd><p>Literal keyword of an @rule (e.g. <tt class="docutils literal"><span class="pre">@IMport</span></tt>).</p>
1263
<dl class="attribute">
1264
<dt id="cssutils.css.CSSComment.cssText">
1265
<tt class="descname">cssText</tt><a class="headerlink" href="#cssutils.css.CSSComment.cssText" title="Permalink to this definition">¶</a></dt>
1266
<dd><p>The parsable textual representation of this rule.</p>
1269
<dl class="attribute">
1270
<dt id="cssutils.css.CSSComment.parent">
1271
<tt class="descname">parent</tt><a class="headerlink" href="#cssutils.css.CSSComment.parent" title="Permalink to this definition">¶</a></dt>
1272
<dd><p>The Parent Node of this CSSRule or None.</p>
1275
<dl class="attribute">
1276
<dt id="cssutils.css.CSSComment.parentRule">
1277
<tt class="descname">parentRule</tt><a class="headerlink" href="#cssutils.css.CSSComment.parentRule" title="Permalink to this definition">¶</a></dt>
1278
<dd><p>If this rule is contained inside another rule (e.g. a style rule inside an @media block), this is the containing rule. If this rule is not nested inside any other rules, this returns None.</p>
1281
<dl class="attribute">
1282
<dt id="cssutils.css.CSSComment.parentStyleSheet">
1283
<tt class="descname">parentStyleSheet</tt><a class="headerlink" href="#cssutils.css.CSSComment.parentStyleSheet" title="Permalink to this definition">¶</a></dt>
1284
<dd><p>The style sheet that contains this rule.</p>
1287
<dl class="attribute">
1288
<dt id="cssutils.css.CSSComment.seq">
1289
<tt class="descname">seq</tt><a class="headerlink" href="#cssutils.css.CSSComment.seq" title="Permalink to this definition">¶</a></dt>
1290
<dd><p>Internal readonly attribute, <strong>DO NOT USE</strong>!</p>
1293
<dl class="attribute">
1294
<dt id="cssutils.css.CSSComment.type">
1295
<tt class="descname">type</tt><a class="headerlink" href="#cssutils.css.CSSComment.type" title="Permalink to this definition">¶</a></dt>
1296
<dd><p>The type of this rule, as defined by a CSSRule type constant.</p>
1299
<dl class="attribute">
1300
<dt id="cssutils.css.CSSComment.typeString">
1301
<tt class="descname">typeString</tt><a class="headerlink" href="#cssutils.css.CSSComment.typeString" title="Permalink to this definition">¶</a></dt>
1302
<dd><p>Descriptive name of this rule’s type.</p>
1309
<div class="section" id="selector-related-classes-selectorlist-and-selector">
1310
<h2>Selector related classes: <tt class="docutils literal"><span class="pre">SelectorList</span></tt> and <tt class="docutils literal"><span class="pre">Selector</span></tt><a class="headerlink" href="#selector-related-classes-selectorlist-and-selector" title="Permalink to this headline">¶</a></h2>
1311
<div class="section" id="selectorlist">
1312
<h3><tt class="docutils literal"><span class="pre">SelectorList</span></tt><a class="headerlink" href="#selectorlist" title="Permalink to this headline">¶</a></h3>
1314
<dt id="cssutils.css.SelectorList">
1315
<em class="property">class </em><tt class="descclassname">cssutils.css.</tt><tt class="descname">SelectorList</tt><big>(</big><em>selectorText=None</em>, <em>parentRule=None</em>, <em>readonly=False</em><big>)</big><a class="headerlink" href="#cssutils.css.SelectorList" title="Permalink to this definition">¶</a></dt>
1316
<dd><p>A list of <a class="reference internal" href="#cssutils.css.Selector" title="cssutils.css.Selector"><tt class="xref py py-class docutils literal"><span class="pre">Selector</span></tt></a> objects
1317
of a <a class="reference internal" href="#cssutils.css.CSSStyleRule" title="cssutils.css.CSSStyleRule"><tt class="xref py py-class docutils literal"><span class="pre">CSSStyleRule</span></tt></a>.</p>
1319
<dt id="cssutils.css.SelectorList.append">
1320
<tt class="descname">append</tt><big>(</big><em>newSelector</em><big>)</big><a class="headerlink" href="#cssutils.css.SelectorList.append" title="Permalink to this definition">¶</a></dt>
1321
<dd><p>Same as <a class="reference internal" href="#cssutils.css.SelectorList.appendSelector" title="cssutils.css.SelectorList.appendSelector"><tt class="xref py py-meth docutils literal"><span class="pre">appendSelector()</span></tt></a>.</p>
1325
<dt id="cssutils.css.SelectorList.appendSelector">
1326
<tt class="descname">appendSelector</tt><big>(</big><em>newSelector</em><big>)</big><a class="headerlink" href="#cssutils.css.SelectorList.appendSelector" title="Permalink to this definition">¶</a></dt>
1327
<dd><p>Append <cite>newSelector</cite> to this list (a string will be converted to a
1328
<a class="reference internal" href="#cssutils.css.Selector" title="cssutils.css.Selector"><tt class="xref py py-class docutils literal"><span class="pre">Selector</span></tt></a>).</p>
1329
<table class="docutils field-list" frame="void" rules="none">
1330
<col class="field-name" />
1331
<col class="field-body" />
1332
<tbody valign="top">
1333
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1334
<li><strong>newSelector</strong> – comma-separated list of selectors (as a single string) or a tuple of
1335
<cite>(newSelector, dict-of-namespaces)</cite></li>
1339
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">New <a class="reference internal" href="#cssutils.css.Selector" title="cssutils.css.Selector"><tt class="xref py py-class docutils literal"><span class="pre">Selector</span></tt></a> or <tt class="xref docutils literal"><span class="pre">None</span></tt> if
1340
<cite>newSelector</cite> is not wellformed.</p>
1343
<tr class="field"><th class="field-name">Exceptions :</th><td class="field-body"><ul class="first last simple">
1344
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.NamespaceErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">NamespaceErr</span></tt></a>:
1345
Raised if the specified selector uses an unknown namespace
1347
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.SyntaxErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">SyntaxErr</span></tt></a>:
1348
Raised if the specified CSS string value has a syntax error
1349
and is unparsable.</li>
1350
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.NoModificationAllowedErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">NoModificationAllowedErr</span></tt></a>:
1351
Raised if this rule is readonly.</li>
1359
<dl class="attribute">
1360
<dt id="cssutils.css.SelectorList.length">
1361
<tt class="descname">length</tt><a class="headerlink" href="#cssutils.css.SelectorList.length" title="Permalink to this definition">¶</a></dt>
1362
<dd><p>The number of <a class="reference internal" href="#cssutils.css.Selector" title="cssutils.css.Selector"><tt class="xref py py-class docutils literal"><span class="pre">Selector</span></tt></a> objects in the list.</p>
1365
<dl class="attribute">
1366
<dt id="cssutils.css.SelectorList.parentRule">
1367
<tt class="descname">parentRule</tt><a class="headerlink" href="#cssutils.css.SelectorList.parentRule" title="Permalink to this definition">¶</a></dt>
1368
<dd><p>(DOM) The CSS rule that contains this SelectorList or <tt class="xref docutils literal"><span class="pre">None</span></tt> if this SelectorList is not attached to a CSSRule.</p>
1371
<dl class="attribute">
1372
<dt id="cssutils.css.SelectorList.selectorText">
1373
<tt class="descname">selectorText</tt><a class="headerlink" href="#cssutils.css.SelectorList.selectorText" title="Permalink to this definition">¶</a></dt>
1374
<dd><p>(cssutils) The textual representation of the selector for a rule set.</p>
1380
<div class="section" id="selector">
1381
<h3><tt class="docutils literal"><span class="pre">Selector</span></tt><a class="headerlink" href="#selector" title="Permalink to this headline">¶</a></h3>
1383
<dt id="cssutils.css.Selector">
1384
<em class="property">class </em><tt class="descclassname">cssutils.css.</tt><tt class="descname">Selector</tt><big>(</big><em>selectorText=None</em>, <em>parent=None</em>, <em>readonly=False</em><big>)</big><a class="headerlink" href="#cssutils.css.Selector" title="Permalink to this definition">¶</a></dt>
1385
<dd><p>(cssutils) a single selector in a <a class="reference internal" href="#cssutils.css.SelectorList" title="cssutils.css.SelectorList"><tt class="xref py py-class docutils literal"><span class="pre">SelectorList</span></tt></a>
1386
of a <a class="reference internal" href="#cssutils.css.CSSStyleRule" title="cssutils.css.CSSStyleRule"><tt class="xref py py-class docutils literal"><span class="pre">CSSStyleRule</span></tt></a>.</p>
1388
<div class="highlight-python"><pre># implemented in SelectorList
1390
: selector [ COMMA S* selector ]*
1394
: simple_selector_sequence [ combinator simple_selector_sequence ]*
1398
/* combinators can be surrounded by white space */
1399
: PLUS S* | GREATER S* | TILDE S* | S+
1402
simple_selector_sequence
1403
: [ type_selector | universal ]
1404
[ HASH | class | attrib | pseudo | negation ]*
1405
| [ HASH | class | attrib | pseudo | negation ]+
1409
: [ namespace_prefix ]? element_name
1413
: [ IDENT | '*' ]? '|'
1421
: [ namespace_prefix ]? '*'
1429
: '[' S* [ namespace_prefix ]? IDENT S*
1435
DASHMATCH ] S* [ IDENT | STRING ] S*
1440
/* '::' starts a pseudo-element, ':' a pseudo-class */
1441
/* Exceptions: :first-line, :first-letter, :before and :after. */
1442
/* Note that pseudo-elements are restricted to one per selector and */
1443
/* occur only in the last simple_selector_sequence. */
1444
: ':' ':'? [ IDENT | functional_pseudo ]
1448
: FUNCTION S* expression ')'
1452
/* In CSS3, the expressions are identifiers, strings, */
1453
/* or of the form "an+b" */
1454
: [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+
1458
: NOT S* negation_arg S* ')'
1462
: type_selector | universal | HASH | class | attrib | pseudo
1465
<dl class="attribute">
1466
<dt id="cssutils.css.Selector.element">
1467
<tt class="descname">element</tt><a class="headerlink" href="#cssutils.css.Selector.element" title="Permalink to this definition">¶</a></dt>
1468
<dd><p>Effective element target of this selector.</p>
1471
<dl class="attribute">
1472
<dt id="cssutils.css.Selector.parent">
1473
<tt class="descname">parent</tt><a class="headerlink" href="#cssutils.css.Selector.parent" title="Permalink to this definition">¶</a></dt>
1474
<dd><p>(DOM) The SelectorList that contains this Selector or None if this Selector is not attached to a SelectorList.</p>
1477
<dl class="attribute">
1478
<dt id="cssutils.css.Selector.parentList">
1479
<tt class="descname">parentList</tt><a class="headerlink" href="#cssutils.css.Selector.parentList" title="Permalink to this definition">¶</a></dt>
1480
<dd><p>DEPRECATED, see property parent instead</p>
1483
<dl class="attribute">
1484
<dt id="cssutils.css.Selector.selectorText">
1485
<tt class="descname">selectorText</tt><a class="headerlink" href="#cssutils.css.Selector.selectorText" title="Permalink to this definition">¶</a></dt>
1486
<dd><p>(DOM) The parsable textual representation of the selector.</p>
1489
<dl class="attribute">
1490
<dt id="cssutils.css.Selector.seq">
1491
<tt class="descname">seq</tt><a class="headerlink" href="#cssutils.css.Selector.seq" title="Permalink to this definition">¶</a></dt>
1492
<dd><p>Internal readonly attribute, <strong>DO NOT USE</strong>!</p>
1495
<dl class="attribute">
1496
<dt id="cssutils.css.Selector.specificity">
1497
<tt class="descname">specificity</tt><a class="headerlink" href="#cssutils.css.Selector.specificity" title="Permalink to this definition">¶</a></dt>
1498
<dd><p>Specificity of this selector (READONLY).
1499
Tuple of (a, b, c, d) where:</p>
1500
<dl class="docutils">
1502
<dd>presence of style in document, always 0 if not used on a
1505
<dd>number of ID selectors</dd>
1507
<dd>number of .class selectors</dd>
1509
<dd>number of Element (type) selectors</dd>
1517
<div class="section" id="style-related-classes-cssstyledeclaration-property-cssvalue-etc">
1518
<h2>Style related classes: <tt class="docutils literal"><span class="pre">CSSStyleDeclaration</span></tt>, <tt class="docutils literal"><span class="pre">Property</span></tt>, <tt class="docutils literal"><span class="pre">CSSValue</span></tt> etc<a class="headerlink" href="#style-related-classes-cssstyledeclaration-property-cssvalue-etc" title="Permalink to this headline">¶</a></h2>
1519
<div class="section" id="cssvariablesdeclaration">
1520
<h3><tt class="docutils literal"><span class="pre">CSSVariablesDeclaration</span></tt><a class="headerlink" href="#cssvariablesdeclaration" title="Permalink to this headline">¶</a></h3>
1522
<dt id="cssutils.css.CSSVariablesDeclaration">
1523
<em class="property">class </em><tt class="descclassname">cssutils.css.</tt><tt class="descname">CSSVariablesDeclaration</tt><big>(</big><em>cssText=u''</em>, <em>parentRule=None</em>, <em>readonly=False</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSVariablesDeclaration" title="Permalink to this definition">¶</a></dt>
1524
<dd><p>The CSSVariablesDeclaration interface represents a single block of
1525
variable declarations.</p>
1526
<dl class="attribute">
1527
<dt id="cssutils.css.CSSVariablesDeclaration.cssText">
1528
<tt class="descname">cssText</tt><a class="headerlink" href="#cssutils.css.CSSVariablesDeclaration.cssText" title="Permalink to this definition">¶</a></dt>
1529
<dd><p>(DOM) A parsable textual representation of the declaration block excluding the surrounding curly braces.</p>
1533
<dt id="cssutils.css.CSSVariablesDeclaration.getVariableValue">
1534
<tt class="descname">getVariableValue</tt><big>(</big><em>variableName</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSVariablesDeclaration.getVariableValue" title="Permalink to this definition">¶</a></dt>
1535
<dd><p>Used to retrieve the value of a variable if it has been explicitly
1536
set within this variable declaration block.</p>
1537
<table class="docutils field-list" frame="void" rules="none">
1538
<col class="field-name" />
1539
<col class="field-body" />
1540
<tbody valign="top">
1541
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1542
<li><strong>variableName</strong> – The name of the variable.</li>
1546
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">the value of the variable if it has been explicitly set in this
1547
variable declaration block. Returns the empty string if the
1548
variable has not been set.</p>
1556
<dt id="cssutils.css.CSSVariablesDeclaration.item">
1557
<tt class="descname">item</tt><big>(</big><em>index</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSVariablesDeclaration.item" title="Permalink to this definition">¶</a></dt>
1558
<dd><p>Used to retrieve the variables that have been explicitly set in
1559
this variable declaration block. The order of the variables
1560
retrieved using this method does not have to be the order in which
1561
they were set. This method can be used to iterate over all variables
1562
in this variable declaration block.</p>
1563
<table class="docutils field-list" frame="void" rules="none">
1564
<col class="field-name" />
1565
<col class="field-body" />
1566
<tbody valign="top">
1567
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1568
<li><strong>index</strong> – of the variable name to retrieve, negative values behave like
1569
negative indexes on Python lists, so -1 is the last element</li>
1573
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">The name of the variable at this ordinal position. The empty
1574
string if no variable exists at this position.</p>
1582
<dt id="cssutils.css.CSSVariablesDeclaration.keys">
1583
<tt class="descname">keys</tt><big>(</big><big>)</big><a class="headerlink" href="#cssutils.css.CSSVariablesDeclaration.keys" title="Permalink to this definition">¶</a></dt>
1584
<dd><p>Analoguous to standard dict returns variable names which are set in
1585
this declaration.</p>
1588
<dl class="attribute">
1589
<dt id="cssutils.css.CSSVariablesDeclaration.length">
1590
<tt class="descname">length</tt><a class="headerlink" href="#cssutils.css.CSSVariablesDeclaration.length" title="Permalink to this definition">¶</a></dt>
1591
<dd><p>The number of variables that have been explicitly set in this variable declaration block. The range of valid indices is 0 to length-1 inclusive.</p>
1594
<dl class="attribute">
1595
<dt id="cssutils.css.CSSVariablesDeclaration.parentRule">
1596
<tt class="descname">parentRule</tt><a class="headerlink" href="#cssutils.css.CSSVariablesDeclaration.parentRule" title="Permalink to this definition">¶</a></dt>
1597
<dd><p>(DOM) The CSS rule that contains this declaration block or None if this block is not attached to a CSSRule.</p>
1601
<dt id="cssutils.css.CSSVariablesDeclaration.removeVariable">
1602
<tt class="descname">removeVariable</tt><big>(</big><em>variableName</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSVariablesDeclaration.removeVariable" title="Permalink to this definition">¶</a></dt>
1603
<dd><p>Used to remove a variable if it has been explicitly set within this
1604
variable declaration block.</p>
1605
<table class="docutils field-list" frame="void" rules="none">
1606
<col class="field-name" />
1607
<col class="field-body" />
1608
<tbody valign="top">
1609
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1610
<li><strong>variableName</strong> – The name of the variable.</li>
1614
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the value of the variable if it has been explicitly set for this
1615
variable declaration block. Returns the empty string if the
1616
variable has not been set.</p>
1619
<tr class="field"><th class="field-name">Exceptions :</th><td class="field-body"><ul class="first last simple">
1620
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.NoModificationAllowedErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">NoModificationAllowedErr</span></tt></a>:
1621
Raised if this declaration is readonly is readonly.</li>
1629
<dl class="attribute">
1630
<dt id="cssutils.css.CSSVariablesDeclaration.seq">
1631
<tt class="descname">seq</tt><a class="headerlink" href="#cssutils.css.CSSVariablesDeclaration.seq" title="Permalink to this definition">¶</a></dt>
1632
<dd><p>Internal readonly attribute, <strong>DO NOT USE</strong>!</p>
1636
<dt id="cssutils.css.CSSVariablesDeclaration.setVariable">
1637
<tt class="descname">setVariable</tt><big>(</big><em>variableName</em>, <em>value</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSVariablesDeclaration.setVariable" title="Permalink to this definition">¶</a></dt>
1638
<dd><p>Used to set a variable value within this variable declaration block.</p>
1639
<table class="docutils field-list" frame="void" rules="none">
1640
<col class="field-name" />
1641
<col class="field-body" />
1642
<tbody valign="top">
1643
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1644
<li><strong>variableName</strong> – The name of the CSS variable.</li>
1645
<li><strong>value</strong> – The new value of the variable, may also be a CSSValue object.</li>
1649
<tr class="field"><th class="field-name">Exceptions :</th><td class="field-body"><ul class="first last simple">
1650
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.SyntaxErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">SyntaxErr</span></tt></a>:
1651
Raised if the specified value has a syntax error and is
1653
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.NoModificationAllowedErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">NoModificationAllowedErr</span></tt></a>:
1654
Raised if this declaration is readonly or the property is
1666
<div class="section" id="cssstyledeclaration">
1667
<h3><tt class="docutils literal"><span class="pre">CSSStyleDeclaration</span></tt><a class="headerlink" href="#cssstyledeclaration" title="Permalink to this headline">¶</a></h3>
1669
<dt id="cssutils.css.CSSStyleDeclaration">
1670
<em class="property">class </em><tt class="descclassname">cssutils.css.</tt><tt class="descname">CSSStyleDeclaration</tt><big>(</big><em>cssText=u''</em>, <em>parentRule=None</em>, <em>readonly=False</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSStyleDeclaration" title="Permalink to this definition">¶</a></dt>
1671
<dd><p>The CSSStyleDeclaration class represents a single CSS declaration
1672
block. This class may be used to determine the style properties
1673
currently set in a block or to set style properties explicitly
1674
within the block.</p>
1675
<p>While an implementation may not recognize all CSS properties within
1676
a CSS declaration block, it is expected to provide access to all
1677
specified properties in the style sheet through the
1678
CSSStyleDeclaration interface.
1679
Furthermore, implementations that support a specific level of CSS
1680
should correctly handle CSS shorthand properties for that level. For
1681
a further discussion of shorthand properties, see the CSS2Properties
1683
<p>Additionally the CSS2Properties interface is implemented.</p>
1684
<dl class="docutils">
1685
<dt>$css2propertyname</dt>
1686
<dd><p class="first">All properties defined in the CSS2Properties class are available
1687
as direct properties of CSSStyleDeclaration with their respective
1688
DOM name, so e.g. <tt class="docutils literal"><span class="pre">fontStyle</span></tt> for property ‘font-style’.</p>
1689
<p>These may be used as:</p>
1690
<div class="last highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">style</span> <span class="o">=</span> <span class="n">CSSStyleDeclaration</span><span class="p">(</span><span class="n">cssText</span><span class="o">=</span><span class="s">'color: red'</span><span class="p">)</span>
1691
<span class="gp">>>> </span><span class="n">style</span><span class="o">.</span><span class="n">color</span> <span class="o">=</span> <span class="s">'green'</span>
1692
<span class="gp">>>> </span><span class="k">print</span> <span class="n">style</span><span class="o">.</span><span class="n">color</span>
1693
<span class="go">green</span>
1694
<span class="gp">>>> </span><span class="k">del</span> <span class="n">style</span><span class="o">.</span><span class="n">color</span>
1695
<span class="gp">>>> </span><span class="k">print</span> <span class="n">style</span><span class="o">.</span><span class="n">color</span>
1696
<span class="go"><BLANKLINE></span>
1702
<div class="highlight-python"><pre>[Property: Value Priority?;]* [Property: Value Priority?]?</pre>
1705
<dt id="cssutils.css.CSSStyleDeclaration.children">
1706
<tt class="descname">children</tt><big>(</big><big>)</big><a class="headerlink" href="#cssutils.css.CSSStyleDeclaration.children" title="Permalink to this definition">¶</a></dt>
1707
<dd><p>Generator yielding any known child in this declaration including
1708
<em>all</em> properties, comments or CSSUnknownrules.</p>
1711
<dl class="attribute">
1712
<dt id="cssutils.css.CSSStyleDeclaration.cssText">
1713
<tt class="descname">cssText</tt><a class="headerlink" href="#cssutils.css.CSSStyleDeclaration.cssText" title="Permalink to this definition">¶</a></dt>
1714
<dd><p>(DOM) A parsable textual representation of the declaration block excluding the surrounding curly braces.</p>
1718
<dt id="cssutils.css.CSSStyleDeclaration.getCssText">
1719
<tt class="descname">getCssText</tt><big>(</big><em>separator=None</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSStyleDeclaration.getCssText" title="Permalink to this definition">¶</a></dt>
1720
<dd><table class="docutils field-list" frame="void" rules="none">
1721
<col class="field-name" />
1722
<col class="field-body" />
1723
<tbody valign="top">
1724
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">serialized property cssText, each property separated by
1725
given <cite>separator</cite> which may e.g. be <tt class="docutils literal"><span class="pre">u''</span></tt> to be able to use
1726
cssText directly in an HTML style attribute. <tt class="docutils literal"><span class="pre">;</span></tt> is part of
1727
each property (except the last one) and <strong>cannot</strong> be set with
1735
<dt id="cssutils.css.CSSStyleDeclaration.getProperties">
1736
<tt class="descname">getProperties</tt><big>(</big><em>name=None</em>, <em>all=False</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSStyleDeclaration.getProperties" title="Permalink to this definition">¶</a></dt>
1737
<dd><table class="docutils field-list" frame="void" rules="none">
1738
<col class="field-name" />
1739
<col class="field-body" />
1740
<tbody valign="top">
1741
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1742
<li><strong>name</strong> – optional <cite>name</cite> of properties which are requested.
1743
Only properties with this <strong>always normalized</strong> <cite>name</cite> are returned.
1744
If <cite>name</cite> is <tt class="xref docutils literal"><span class="pre">None</span></tt> all properties are returned (at least one for
1745
each set name depending on parameter <cite>all</cite>).</li>
1746
<li><strong>all</strong> – <p>if <tt class="xref docutils literal"><span class="pre">False</span></tt> (DEFAULT) only the effective properties are returned.
1747
If name is given a list with only one property is returned.</p>
1748
<p>if <tt class="xref docutils literal"><span class="pre">True</span></tt> all properties including properties set multiple times
1749
with different values or priorities for different UAs are returned.
1750
The order of the properties is fully kept as in the original
1756
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">a list of <a class="reference internal" href="#cssutils.css.Property" title="cssutils.css.Property"><tt class="xref py py-class docutils literal"><span class="pre">Property</span></tt></a> objects set in
1757
this declaration.</p>
1765
<dt id="cssutils.css.CSSStyleDeclaration.getProperty">
1766
<tt class="descname">getProperty</tt><big>(</big><em>name</em>, <em>normalize=True</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSStyleDeclaration.getProperty" title="Permalink to this definition">¶</a></dt>
1767
<dd><table class="docutils field-list" frame="void" rules="none">
1768
<col class="field-name" />
1769
<col class="field-body" />
1770
<tbody valign="top">
1771
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1772
<li><strong>name</strong> – of the CSS property, always lowercase (even if not normalized)</li>
1773
<li><strong>normalize</strong> – <p>if <tt class="xref docutils literal"><span class="pre">True</span></tt> (DEFAULT) name will be normalized (lowercase, no simple
1774
escapes) so “color”, “COLOR” or “Color” will all be equivalent</p>
1775
<p>If <tt class="xref docutils literal"><span class="pre">False</span></tt> may return <strong>NOT</strong> the effective value but the
1776
effective for the unnormalized name.</p>
1781
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">the effective <a class="reference internal" href="#cssutils.css.Property" title="cssutils.css.Property"><tt class="xref py py-class docutils literal"><span class="pre">Property</span></tt></a> object.</p>
1789
<dt id="cssutils.css.CSSStyleDeclaration.getPropertyCSSValue">
1790
<tt class="descname">getPropertyCSSValue</tt><big>(</big><em>name</em>, <em>normalize=True</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSStyleDeclaration.getPropertyCSSValue" title="Permalink to this definition">¶</a></dt>
1791
<dd><table class="docutils field-list" frame="void" rules="none">
1792
<col class="field-name" />
1793
<col class="field-body" />
1794
<tbody valign="top">
1795
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1796
<li><strong>name</strong> – of the CSS property, always lowercase (even if not normalized)</li>
1797
<li><strong>normalize</strong> – <p>if <tt class="xref docutils literal"><span class="pre">True</span></tt> (DEFAULT) name will be normalized (lowercase, no simple
1798
escapes) so “color”, “COLOR” or “Color” will all be equivalent</p>
1799
<p>If <tt class="xref docutils literal"><span class="pre">False</span></tt> may return <strong>NOT</strong> the effective value but the
1800
effective for the unnormalized name.</p>
1805
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#cssutils.css.CSSValue" title="cssutils.css.CSSValue"><tt class="xref py py-class docutils literal"><span class="pre">CSSValue</span></tt></a>, the value of the effective
1806
property if it has been explicitly set for this declaration block.</p>
1812
Used to retrieve the object representation of the value of a CSS
1813
property if it has been explicitly set within this declaration
1814
block. Returns None if the property has not been set.</p>
1815
<p>(This method returns None if the property is a shorthand
1816
property. Shorthand property values can only be accessed and
1817
modified as strings, using the getPropertyValue and setProperty
1819
<p><strong>cssutils currently always returns a CSSValue if the property is
1821
<dl class="docutils">
1822
<dt>for more on shorthand properties see</dt>
1823
<dd><a class="reference external" href="http://www.dustindiaz.com/css-shorthand/">http://www.dustindiaz.com/css-shorthand/</a></dd>
1828
<dt id="cssutils.css.CSSStyleDeclaration.getPropertyPriority">
1829
<tt class="descname">getPropertyPriority</tt><big>(</big><em>name</em>, <em>normalize=True</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSStyleDeclaration.getPropertyPriority" title="Permalink to this definition">¶</a></dt>
1830
<dd><table class="docutils field-list" frame="void" rules="none">
1831
<col class="field-name" />
1832
<col class="field-body" />
1833
<tbody valign="top">
1834
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1835
<li><strong>name</strong> – of the CSS property, always lowercase (even if not normalized)</li>
1836
<li><strong>normalize</strong> – <p>if <tt class="xref docutils literal"><span class="pre">True</span></tt> (DEFAULT) name will be normalized (lowercase, no simple
1837
escapes) so “color”, “COLOR” or “Color” will all be equivalent</p>
1838
<p>If <tt class="xref docutils literal"><span class="pre">False</span></tt> may return <strong>NOT</strong> the effective value but the
1839
effective for the unnormalized name.</p>
1844
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">the priority of the effective CSS property (e.g. the
1845
“important” qualifier) if the property has been explicitly set in
1846
this declaration block. The empty string if none exists.</p>
1854
<dt id="cssutils.css.CSSStyleDeclaration.getPropertyValue">
1855
<tt class="descname">getPropertyValue</tt><big>(</big><em>name</em>, <em>normalize=True</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSStyleDeclaration.getPropertyValue" title="Permalink to this definition">¶</a></dt>
1856
<dd><table class="docutils field-list" frame="void" rules="none">
1857
<col class="field-name" />
1858
<col class="field-body" />
1859
<tbody valign="top">
1860
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1861
<li><strong>name</strong> – of the CSS property, always lowercase (even if not normalized)</li>
1862
<li><strong>normalize</strong> – <p>if <tt class="xref docutils literal"><span class="pre">True</span></tt> (DEFAULT) name will be normalized (lowercase, no simple
1863
escapes) so “color”, “COLOR” or “Color” will all be equivalent</p>
1864
<p>If <tt class="xref docutils literal"><span class="pre">False</span></tt> may return <strong>NOT</strong> the effective value but the
1865
effective for the unnormalized name.</p>
1870
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">the value of the effective property if it has been explicitly set
1871
for this declaration block. Returns the empty string if the
1872
property has not been set.</p>
1880
<dt id="cssutils.css.CSSStyleDeclaration.item">
1881
<tt class="descname">item</tt><big>(</big><em>index</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSStyleDeclaration.item" title="Permalink to this definition">¶</a></dt>
1882
<dd><p>(DOM) Retrieve the properties that have been explicitly set in
1883
this declaration block. The order of the properties retrieved using
1884
this method does not have to be the order in which they were set.
1885
This method can be used to iterate over all properties in this
1886
declaration block.</p>
1887
<table class="docutils field-list" frame="void" rules="none">
1888
<col class="field-name" />
1889
<col class="field-body" />
1890
<tbody valign="top">
1891
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1892
<li><strong>index</strong> – of the property to retrieve, negative values behave like
1893
negative indexes on Python lists, so -1 is the last element</li>
1897
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">the name of the property at this ordinal position. The
1898
empty string if no property exists at this position.</p>
1903
<p><strong>ATTENTION:</strong>
1904
Only properties with different names are counted. If two
1905
properties with the same name are present in this declaration
1906
only the effective one is included.</p>
1907
<p><a class="reference internal" href="#cssutils.css.CSSStyleDeclaration.item" title="cssutils.css.CSSStyleDeclaration.item"><tt class="xref py py-meth docutils literal"><span class="pre">item()</span></tt></a> and <a class="reference internal" href="#cssutils.css.CSSStyleDeclaration.length" title="cssutils.css.CSSStyleDeclaration.length"><tt class="xref py py-attr docutils literal"><span class="pre">length</span></tt></a> work on the same set here.</p>
1911
<dt id="cssutils.css.CSSStyleDeclaration.keys">
1912
<tt class="descname">keys</tt><big>(</big><big>)</big><a class="headerlink" href="#cssutils.css.CSSStyleDeclaration.keys" title="Permalink to this definition">¶</a></dt>
1913
<dd><p>Analoguous to standard dict returns property names which are set in
1914
this declaration.</p>
1917
<dl class="attribute">
1918
<dt id="cssutils.css.CSSStyleDeclaration.length">
1919
<tt class="descname">length</tt><a class="headerlink" href="#cssutils.css.CSSStyleDeclaration.length" title="Permalink to this definition">¶</a></dt>
1920
<dd><p>(DOM) The number of distinct properties that have been explicitly in this declaration block. The range of valid indices is 0 to length-1 inclusive. These are properties with a different <tt class="docutils literal"><span class="pre">name</span></tt> only. <a class="reference internal" href="#cssutils.css.CSSStyleDeclaration.item" title="cssutils.css.CSSStyleDeclaration.item"><tt class="xref py py-meth docutils literal"><span class="pre">item()</span></tt></a> and <a class="reference internal" href="#cssutils.css.CSSStyleDeclaration.length" title="cssutils.css.CSSStyleDeclaration.length"><tt class="xref py py-attr docutils literal"><span class="pre">length</span></tt></a> work on the same set here.</p>
1923
<dl class="attribute">
1924
<dt id="cssutils.css.CSSStyleDeclaration.parentRule">
1925
<tt class="descname">parentRule</tt><a class="headerlink" href="#cssutils.css.CSSStyleDeclaration.parentRule" title="Permalink to this definition">¶</a></dt>
1926
<dd><p>(DOM) The CSS rule that contains this declaration block or None if this CSSStyleDeclaration is not attached to a CSSRule.</p>
1930
<dt id="cssutils.css.CSSStyleDeclaration.removeProperty">
1931
<tt class="descname">removeProperty</tt><big>(</big><em>name</em>, <em>normalize=True</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSStyleDeclaration.removeProperty" title="Permalink to this definition">¶</a></dt>
1933
Used to remove a CSS property if it has been explicitly set within
1934
this declaration block.</p>
1935
<table class="docutils field-list" frame="void" rules="none">
1936
<col class="field-name" />
1937
<col class="field-body" />
1938
<tbody valign="top">
1939
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1940
<li><strong>name</strong> – of the CSS property</li>
1941
<li><strong>normalize</strong> – <p>if <tt class="xref docutils literal"><span class="pre">True</span></tt> (DEFAULT) name will be normalized (lowercase, no simple
1942
escapes) so “color”, “COLOR” or “Color” will all be equivalent.
1943
The effective Property value is returned and <em>all</em> Properties
1944
with <tt class="docutils literal"><span class="pre">Property.name</span> <span class="pre">==</span> <span class="pre">name</span></tt> are removed.</p>
1945
<p>If <tt class="xref docutils literal"><span class="pre">False</span></tt> may return <strong>NOT</strong> the effective value but the
1946
effective for the unnormalized <cite>name</cite> only. Also only the
1947
Properties with the literal name <cite>name</cite> are removed.</p>
1952
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the value of the property if it has been explicitly set for
1953
this declaration block. Returns the empty string if the property
1954
has not been set or the property name does not correspond to a
1955
known CSS property</p>
1958
<tr class="field"><th class="field-name">Exceptions :</th><td class="field-body"><ul class="first last simple">
1959
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.NoModificationAllowedErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">NoModificationAllowedErr</span></tt></a>:
1960
Raised if this declaration is readonly or the property is
1969
<dl class="attribute">
1970
<dt id="cssutils.css.CSSStyleDeclaration.seq">
1971
<tt class="descname">seq</tt><a class="headerlink" href="#cssutils.css.CSSStyleDeclaration.seq" title="Permalink to this definition">¶</a></dt>
1972
<dd><p>Internal readonly attribute, <strong>DO NOT USE</strong>!</p>
1976
<dt id="cssutils.css.CSSStyleDeclaration.setProperty">
1977
<tt class="descname">setProperty</tt><big>(</big><em>name</em>, <em>value=None</em>, <em>priority=u''</em>, <em>normalize=True</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSStyleDeclaration.setProperty" title="Permalink to this definition">¶</a></dt>
1978
<dd><p>(DOM) Set a property value and priority within this declaration
1980
<table class="docutils field-list" frame="void" rules="none">
1981
<col class="field-name" />
1982
<col class="field-body" />
1983
<tbody valign="top">
1984
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
1985
<li><strong>name</strong> – <p>of the CSS property to set (in W3C DOM the parameter is called
1986
“propertyName”), always lowercase (even if not normalized)</p>
1987
<p>If a property with this <cite>name</cite> is present it will be reset.</p>
1988
<p>cssutils also allowed <cite>name</cite> to be a
1989
<a class="reference internal" href="#cssutils.css.Property" title="cssutils.css.Property"><tt class="xref py py-class docutils literal"><span class="pre">Property</span></tt></a> object, all other
1990
parameter are ignored in this case</p>
1992
<li><strong>value</strong> – the new value of the property, ignored if <cite>name</cite> is a Property.</li>
1993
<li><strong>priority</strong> – the optional priority of the property (e.g. “important”),
1994
ignored if <cite>name</cite> is a Property.</li>
1995
<li><strong>normalize</strong> – if True (DEFAULT) <cite>name</cite> will be normalized (lowercase, no simple
1996
escapes) so “color”, “COLOR” or “Color” will all be equivalent</li>
2000
<tr class="field"><th class="field-name">Exceptions :</th><td class="field-body"><ul class="first last simple">
2001
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.SyntaxErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">SyntaxErr</span></tt></a>:
2002
Raised if the specified value has a syntax error and is
2004
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.NoModificationAllowedErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">NoModificationAllowedErr</span></tt></a>:
2005
Raised if this declaration is readonly or the property is
2016
<p>The official DOM provides no method to obtain all values set for a property. Cssutils from 0.9.4 implements the additional method <a class="reference internal" href="#cssutils.css.CSSStyleDeclaration.getProperties" title="cssutils.css.CSSStyleDeclaration.getProperties"><tt class="xref py py-meth docutils literal"><span class="pre">getProperties()</span></tt></a>, example:</p>
2017
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">cssText</span> <span class="o">=</span> <span class="s">'''background: white url(paper.png) scroll; /* for all UAs */</span>
2018
<span class="gp">... </span><span class="s">background: white url(ledger.png) fixed; /* for UAs that do fixed backgrounds */</span>
2019
<span class="gp">... </span><span class="s">'''</span>
2020
<span class="gp">>>> </span><span class="c"># omit comments for this example</span>
2021
<span class="gp">>>> </span><span class="n">cssutils</span><span class="o">.</span><span class="n">ser</span><span class="o">.</span><span class="n">prefs</span><span class="o">.</span><span class="n">keepComments</span> <span class="o">=</span> <span class="bp">False</span>
2022
<span class="gp">>>> </span><span class="n">style</span> <span class="o">=</span> <span class="n">cssutils</span><span class="o">.</span><span class="n">css</span><span class="o">.</span><span class="n">CSSStyleDeclaration</span><span class="p">(</span><span class="n">cssText</span><span class="o">=</span><span class="n">cssText</span><span class="p">)</span>
2023
<span class="gp">>>> </span><span class="k">print</span> <span class="n">style</span><span class="o">.</span><span class="n">cssText</span>
2024
<span class="go">background: white url(paper.png) scroll;</span>
2025
<span class="go">background: white url(ledger.png) fixed;</span>
2026
<span class="gp">>>> </span><span class="c"># work with properties:</span>
2027
<span class="gp">>>> </span><span class="n">proplist</span> <span class="o">=</span> <span class="n">style</span><span class="o">.</span><span class="n">getProperties</span><span class="p">(</span><span class="s">'background'</span><span class="p">,</span> <span class="nb">all</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
2028
<span class="gp">>>> </span><span class="n">proplist</span>
2029
<span class="go">[cssutils.css.Property(name='background', value=u'white url(paper.png) scroll', priority=u''), cssutils.css.Property(name='background', value=u'white url(ledger.png) fixed', priority=u'')]</span>
2030
<span class="gp">>>> </span><span class="k">for</span> <span class="n">prop</span> <span class="ow">in</span> <span class="n">proplist</span><span class="p">:</span> <span class="k">print</span> <span class="n">prop</span><span class="o">.</span><span class="n">value</span>
2031
<span class="go">white url(paper.png) scroll</span>
2032
<span class="go">white url(ledger.png) fixed</span>
2033
<span class="gp">>>> </span><span class="c"># overwrite the current property, to overwrite all iterate over proplist</span>
2034
<span class="gp">>>> </span><span class="n">style</span><span class="p">[</span><span class="s">'background'</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="s">'red'</span><span class="p">,</span> <span class="s">'!important'</span><span class="p">)</span>
2035
<span class="gp">>>> </span><span class="c"># importance in DOM ist 'important' but '!important' works too</span>
2036
<span class="gp">>>> </span><span class="k">print</span> <span class="n">style</span><span class="p">[</span><span class="s">'background'</span><span class="p">],</span> <span class="n">style</span><span class="o">.</span><span class="n">getPropertyPriority</span><span class="p">(</span><span class="s">'background'</span><span class="p">)</span>
2037
<span class="go">red important</span>
2038
<span class="gp">>>> </span><span class="k">print</span> <span class="n">style</span><span class="o">.</span><span class="n">cssText</span>
2039
<span class="go">background: white url(paper.png) scroll;</span>
2040
<span class="go">background: red !important;</span>
2041
<span class="gp">>>> </span><span class="c"># output only "effective" properties</span>
2042
<span class="gp">>>> </span><span class="n">cssutils</span><span class="o">.</span><span class="n">ser</span><span class="o">.</span><span class="n">prefs</span><span class="o">.</span><span class="n">keepAllProperties</span> <span class="o">=</span> <span class="bp">False</span>
2043
<span class="gp">>>> </span><span class="k">print</span> <span class="n">style</span><span class="o">.</span><span class="n">cssText</span>
2044
<span class="go">background: red !important;</span>
2048
<div class="section" id="property">
2049
<h3><tt class="docutils literal"><span class="pre">Property</span></tt><a class="headerlink" href="#property" title="Permalink to this headline">¶</a></h3>
2051
<dt id="cssutils.css.Property">
2052
<em class="property">class </em><tt class="descclassname">cssutils.css.</tt><tt class="descname">Property</tt><big>(</big><em>name=None</em>, <em>value=None</em>, <em>priority=u''</em>, <em>_mediaQuery=False</em>, <em>parent=None</em><big>)</big><a class="headerlink" href="#cssutils.css.Property" title="Permalink to this definition">¶</a></dt>
2053
<dd><p>A CSS property in a StyleDeclaration of a CSSStyleRule (cssutils).</p>
2055
<div class="highlight-python"><pre>property = name
2060
: term [ operator term ]*
2064
[ NUMBER S* | PERCENTAGE S* | LENGTH S* | EMS S* | EXS S* |
2065
ANGLE S* | TIME S* | FREQ S* | function ]
2066
| STRING S* | IDENT S* | URI S* | hexcolor
2069
: FUNCTION S* expr ')' S*
2072
* There is a constraint on the color that it must
2073
* have either 3 or 6 hex-digits (i.e., [0-9a-fA-F])
2074
* after the "#"; e.g., "#000" is OK, but "#abcd" is not.
2084
<dl class="attribute">
2085
<dt id="cssutils.css.Property.cssText">
2086
<tt class="descname">cssText</tt><a class="headerlink" href="#cssutils.css.Property.cssText" title="Permalink to this definition">¶</a></dt>
2087
<dd><p>A parsable textual representation.</p>
2090
<dl class="attribute">
2091
<dt id="cssutils.css.Property.cssValue">
2092
<tt class="descname">cssValue</tt><a class="headerlink" href="#cssutils.css.Property.cssValue" title="Permalink to this definition">¶</a></dt>
2093
<dd><p>(cssutils) CSSValue object of this property</p>
2096
<dl class="attribute">
2097
<dt id="cssutils.css.Property.literalname">
2098
<tt class="descname">literalname</tt><a class="headerlink" href="#cssutils.css.Property.literalname" title="Permalink to this definition">¶</a></dt>
2099
<dd><p>Readonly literal (not normalized) name of this property</p>
2102
<dl class="attribute">
2103
<dt id="cssutils.css.Property.literalpriority">
2104
<tt class="descname">literalpriority</tt><a class="headerlink" href="#cssutils.css.Property.literalpriority" title="Permalink to this definition">¶</a></dt>
2105
<dd><p>Readonly literal (not normalized) priority of this property</p>
2108
<dl class="attribute">
2109
<dt id="cssutils.css.Property.name">
2110
<tt class="descname">name</tt><a class="headerlink" href="#cssutils.css.Property.name" title="Permalink to this definition">¶</a></dt>
2111
<dd><p>Name of this property.</p>
2114
<dl class="attribute">
2115
<dt id="cssutils.css.Property.parent">
2116
<tt class="descname">parent</tt><a class="headerlink" href="#cssutils.css.Property.parent" title="Permalink to this definition">¶</a></dt>
2117
<dd><p>The Parent Node (normally a CSSStyledeclaration) of this Property</p>
2120
<dl class="attribute">
2121
<dt id="cssutils.css.Property.priority">
2122
<tt class="descname">priority</tt><a class="headerlink" href="#cssutils.css.Property.priority" title="Permalink to this definition">¶</a></dt>
2123
<dd><p>Priority of this property.</p>
2126
<dl class="attribute">
2127
<dt id="cssutils.css.Property.valid">
2128
<tt class="descname">valid</tt><a class="headerlink" href="#cssutils.css.Property.valid" title="Permalink to this definition">¶</a></dt>
2129
<dd><p>Check if value of this property is valid in the properties context.</p>
2133
<dt id="cssutils.css.Property.validate">
2134
<tt class="descname">validate</tt><big>(</big><big>)</big><a class="headerlink" href="#cssutils.css.Property.validate" title="Permalink to this definition">¶</a></dt>
2135
<dd><p>Validate value against <cite>profiles</cite> which are checked dynamically.
2136
properties in e.g. @font-face rules are checked against
2137
<tt class="docutils literal"><span class="pre">cssutils.profile.CSS3_FONT_FACE</span></tt> only.</p>
2138
<p>For each of the following cases a message is reported:</p>
2140
<li><dl class="first docutils">
2141
<dt>INVALID (so the property is known but not valid)</dt>
2142
<dd><p class="first last"><tt class="docutils literal"><span class="pre">ERROR</span> <span class="pre">Property:</span> <span class="pre">Invalid</span> <span class="pre">value</span> <span class="pre">for</span> <span class="pre">"{PROFILE-1[/PROFILE-2...]"</span>
2143
<span class="pre">property:</span> <span class="pre">...</span></tt></p>
2147
<li><dl class="first docutils">
2148
<dt>VALID but not in given profiles or defaultProfiles</dt>
2149
<dd><p class="first last"><tt class="docutils literal"><span class="pre">WARNING</span> <span class="pre">Property:</span> <span class="pre">Not</span> <span class="pre">valid</span> <span class="pre">for</span> <span class="pre">profile</span> <span class="pre">"{PROFILE-X}"</span> <span class="pre">but</span> <span class="pre">valid</span>
2150
<span class="pre">"{PROFILE-Y}"</span> <span class="pre">property:</span> <span class="pre">...</span></tt></p>
2154
<li><dl class="first docutils">
2155
<dt>VALID in current profile</dt>
2156
<dd><p class="first last"><tt class="docutils literal"><span class="pre">DEBUG</span> <span class="pre">Found</span> <span class="pre">valid</span> <span class="pre">"{PROFILE-1[/PROFILE-2...]"</span> <span class="pre">property...</span></tt></p>
2160
<li><dl class="first docutils">
2161
<dt>UNKNOWN property</dt>
2162
<dd><p class="first last"><tt class="docutils literal"><span class="pre">WARNING</span> <span class="pre">Unknown</span> <span class="pre">Property</span> <span class="pre">name...</span></tt> is issued</p>
2167
<p>so for example:</p>
2168
<div class="highlight-python"><pre>cssutils.log.setLevel(logging.DEBUG)
2169
parser = cssutils.CSSParser()
2170
s = parser.parseString('''body {
2171
unknown-property: x;
2173
color: rgba(1,2,3,4);
2179
WARNING Property: Unknown Property name. [2:9: unknown-property]
2180
ERROR Property: Invalid value for "CSS Color Module Level 3/CSS Level 2.1" property: 4 [3:9: color]
2181
DEBUG Property: Found valid "CSS Color Module Level 3" value: rgba(1, 2, 3, 4) [4:9: color]
2182
DEBUG Property: Found valid "CSS Level 2.1" value: red [5:9: color]</pre>
2184
<p>and when setting an explicit default profile:</p>
2185
<div class="highlight-python"><pre>cssutils.profile.defaultProfiles = cssutils.profile.CSS_LEVEL_2
2186
s = parser.parseString('''body {
2187
unknown-property: x;
2189
color: rgba(1,2,3,4);
2195
WARNING Property: Unknown Property name. [2:9: unknown-property]
2196
ERROR Property: Invalid value for "CSS Color Module Level 3/CSS Level 2.1" property: 4 [3:9: color]
2197
WARNING Property: Not valid for profile "CSS Level 2.1" but valid "CSS Color Module Level 3" value: rgba(1, 2, 3, 4) [4:9: color]
2198
DEBUG Property: Found valid "CSS Level 2.1" value: red [5:9: color]</pre>
2202
<dl class="attribute">
2203
<dt id="cssutils.css.Property.value">
2204
<tt class="descname">value</tt><a class="headerlink" href="#cssutils.css.Property.value" title="Permalink to this definition">¶</a></dt>
2205
<dd><p>The textual value of this Properties cssValue.</p>
2211
<div class="section" id="values">
2212
<h3>Values<a class="headerlink" href="#values" title="Permalink to this headline">¶</a></h3>
2213
<div class="section" id="cssvalue">
2214
<h4><tt class="docutils literal"><span class="pre">CSSValue</span></tt><a class="headerlink" href="#cssvalue" title="Permalink to this headline">¶</a></h4>
2216
<dt id="cssutils.css.CSSValue">
2217
<em class="property">class </em><tt class="descclassname">cssutils.css.</tt><tt class="descname">CSSValue</tt><big>(</big><em>cssText=None</em>, <em>parent=None</em>, <em>readonly=False</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSValue" title="Permalink to this definition">¶</a></dt>
2218
<dd><p>The CSSValue interface represents a simple or a complex value.
2219
A CSSValue object only occurs in a context of a CSS property.</p>
2220
<dl class="attribute">
2221
<dt id="cssutils.css.CSSValue.cssText">
2222
<tt class="descname">cssText</tt><a class="headerlink" href="#cssutils.css.CSSValue.cssText" title="Permalink to this definition">¶</a></dt>
2223
<dd><p>A string representation of the current value.</p>
2226
<dl class="attribute">
2227
<dt id="cssutils.css.CSSValue.cssValueType">
2228
<tt class="descname">cssValueType</tt><a class="headerlink" href="#cssutils.css.CSSValue.cssValueType" title="Permalink to this definition">¶</a></dt>
2229
<dd><p>A (readonly) code defining the type of the value.</p>
2232
<dl class="attribute">
2233
<dt id="cssutils.css.CSSValue.cssValueTypeString">
2234
<tt class="descname">cssValueTypeString</tt><a class="headerlink" href="#cssutils.css.CSSValue.cssValueTypeString" title="Permalink to this definition">¶</a></dt>
2235
<dd><p>(readonly) Name of cssValueType.</p>
2238
<dl class="attribute">
2239
<dt id="cssutils.css.CSSValue.seq">
2240
<tt class="descname">seq</tt><a class="headerlink" href="#cssutils.css.CSSValue.seq" title="Permalink to this definition">¶</a></dt>
2241
<dd><p>Internal readonly attribute, <strong>DO NOT USE</strong>!</p>
2247
<div class="section" id="cssprimitivevalue">
2248
<h4><tt class="docutils literal"><span class="pre">CSSPrimitiveValue</span></tt><a class="headerlink" href="#cssprimitivevalue" title="Permalink to this headline">¶</a></h4>
2250
<dt id="cssutils.css.CSSPrimitiveValue">
2251
<em class="property">class </em><tt class="descclassname">cssutils.css.</tt><tt class="descname">CSSPrimitiveValue</tt><big>(</big><em>cssText=None</em>, <em>parent=None</em>, <em>readonly=False</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSPrimitiveValue" title="Permalink to this definition">¶</a></dt>
2252
<dd><p>Represents a single CSS Value. May be used to determine the value of a
2253
specific style property currently set in a block or to set a specific
2254
style property explicitly within the block. Might be obtained from the
2255
getPropertyCSSValue method of CSSStyleDeclaration.</p>
2256
<p>Conversions are allowed between absolute values (from millimeters to
2257
centimeters, from degrees to radians, and so on) but not between
2258
relative values. (For example, a pixel value cannot be converted to a
2259
centimeter value.) Percentage values can’t be converted since they are
2260
relative to the parent value (or another property value). There is one
2261
exception for color percentage values: since a color percentage value
2262
is relative to the range 0-255, a color percentage value can be
2263
converted to a number; (see also the RGBColor interface).</p>
2264
<dl class="attribute">
2265
<dt id="cssutils.css.CSSPrimitiveValue.cssText">
2266
<tt class="descname">cssText</tt><a class="headerlink" href="#cssutils.css.CSSPrimitiveValue.cssText" title="Permalink to this definition">¶</a></dt>
2267
<dd><p>A string representation of the current value.</p>
2270
<dl class="attribute">
2271
<dt id="cssutils.css.CSSPrimitiveValue.cssValueTypeString">
2272
<tt class="descname">cssValueTypeString</tt><a class="headerlink" href="#cssutils.css.CSSPrimitiveValue.cssValueTypeString" title="Permalink to this definition">¶</a></dt>
2273
<dd><p>(readonly) Name of cssValueType.</p>
2277
<dt id="cssutils.css.CSSPrimitiveValue.getCounterValue">
2278
<tt class="descname">getCounterValue</tt><big>(</big><big>)</big><a class="headerlink" href="#cssutils.css.CSSPrimitiveValue.getCounterValue" title="Permalink to this definition">¶</a></dt>
2279
<dd><p>(DOM) This method is used to get the Counter value. If
2280
this CSS value doesn’t contain a counter value, a DOMException
2281
is raised. Modification to the corresponding style property
2282
can be achieved using the Counter interface.</p>
2283
<p><strong>Not implemented.</strong></p>
2287
<dt id="cssutils.css.CSSPrimitiveValue.getFloatValue">
2288
<tt class="descname">getFloatValue</tt><big>(</big><em>unitType=None</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSPrimitiveValue.getFloatValue" title="Permalink to this definition">¶</a></dt>
2289
<dd><p>(DOM) This method is used to get a float value in a
2290
specified unit. If this CSS value doesn’t contain a float value
2291
or can’t be converted into the specified unit, a DOMException
2293
<table class="docutils field-list" frame="void" rules="none">
2294
<col class="field-name" />
2295
<col class="field-body" />
2296
<tbody valign="top">
2297
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
2298
<li><strong>unitType</strong> – to get the float value. The unit code can only be a float unit type
2299
(i.e. CSS_NUMBER, CSS_PERCENTAGE, CSS_EMS, CSS_EXS, CSS_PX, CSS_CM,
2300
CSS_MM, CSS_IN, CSS_PT, CSS_PC, CSS_DEG, CSS_RAD, CSS_GRAD, CSS_MS,
2301
CSS_S, CSS_HZ, CSS_KHZ, CSS_DIMENSION) or None in which case
2302
the current dimension is used.</li>
2306
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><p>not necessarily a float but some cases just an integer
2307
e.g. if the value is <tt class="docutils literal"><span class="pre">1px</span></tt> it return <tt class="docutils literal"><span class="pre">1</span></tt> and <strong>not</strong> <tt class="docutils literal"><span class="pre">1.0</span></tt></p>
2308
<p>Conversions might return strange values like 1.000000000001</p>
2317
<dt id="cssutils.css.CSSPrimitiveValue.getRGBColorValue">
2318
<tt class="descname">getRGBColorValue</tt><big>(</big><big>)</big><a class="headerlink" href="#cssutils.css.CSSPrimitiveValue.getRGBColorValue" title="Permalink to this definition">¶</a></dt>
2319
<dd><p>(DOM) This method is used to get the RGB color. If this
2320
CSS value doesn’t contain a RGB color value, a DOMException
2321
is raised. Modification to the corresponding style property
2322
can be achieved using the RGBColor interface.</p>
2326
<dt id="cssutils.css.CSSPrimitiveValue.getRectValue">
2327
<tt class="descname">getRectValue</tt><big>(</big><big>)</big><a class="headerlink" href="#cssutils.css.CSSPrimitiveValue.getRectValue" title="Permalink to this definition">¶</a></dt>
2328
<dd><p>(DOM) This method is used to get the Rect value. If this CSS
2329
value doesn’t contain a rect value, a DOMException is raised.
2330
Modification to the corresponding style property can be achieved
2331
using the Rect interface.</p>
2332
<p><strong>Not implemented.</strong></p>
2336
<dt id="cssutils.css.CSSPrimitiveValue.getStringValue">
2337
<tt class="descname">getStringValue</tt><big>(</big><big>)</big><a class="headerlink" href="#cssutils.css.CSSPrimitiveValue.getStringValue" title="Permalink to this definition">¶</a></dt>
2338
<dd><p>(DOM) This method is used to get the string value. If the
2339
CSS value doesn’t contain a string value, a DOMException is raised.</p>
2340
<p>Some properties (like ‘font-family’ or ‘voice-family’)
2341
convert a whitespace separated list of idents to a string.</p>
2342
<p>Only the actual value is returned so e.g. all the following return the
2343
actual value <tt class="docutils literal"><span class="pre">a</span></tt>: url(a), attr(a), “a”, ‘a’</p>
2346
<dl class="attribute">
2347
<dt id="cssutils.css.CSSPrimitiveValue.primitiveType">
2348
<tt class="descname">primitiveType</tt><a class="headerlink" href="#cssutils.css.CSSPrimitiveValue.primitiveType" title="Permalink to this definition">¶</a></dt>
2349
<dd><p>(readonly) The type of the value as defined by the constants in this class.</p>
2352
<dl class="attribute">
2353
<dt id="cssutils.css.CSSPrimitiveValue.primitiveTypeString">
2354
<tt class="descname">primitiveTypeString</tt><a class="headerlink" href="#cssutils.css.CSSPrimitiveValue.primitiveTypeString" title="Permalink to this definition">¶</a></dt>
2355
<dd><p>Name of primitive type of this value.</p>
2358
<dl class="attribute">
2359
<dt id="cssutils.css.CSSPrimitiveValue.seq">
2360
<tt class="descname">seq</tt><a class="headerlink" href="#cssutils.css.CSSPrimitiveValue.seq" title="Permalink to this definition">¶</a></dt>
2361
<dd><p>Internal readonly attribute, <strong>DO NOT USE</strong>!</p>
2365
<dt id="cssutils.css.CSSPrimitiveValue.setFloatValue">
2366
<tt class="descname">setFloatValue</tt><big>(</big><em>unitType</em>, <em>floatValue</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSPrimitiveValue.setFloatValue" title="Permalink to this definition">¶</a></dt>
2367
<dd><p>(DOM) A method to set the float value with a specified unit.
2368
If the property attached with this value can not accept the
2369
specified unit or the float value, the value will be unchanged and
2370
a DOMException will be raised.</p>
2371
<table class="docutils field-list" frame="void" rules="none">
2372
<col class="field-name" />
2373
<col class="field-body" />
2374
<tbody valign="top">
2375
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
2376
<li><strong>unitType</strong> – a unit code as defined above. The unit code can only be a float
2378
<li><strong>floatValue</strong> – <p>the new float value which does not have to be a float value but
2379
may simple be an int e.g. if setting:</p>
2380
<div class="highlight-python"><div class="highlight"><pre><span class="n">setFloatValue</span><span class="p">(</span><span class="n">CSS_PX</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
2387
<tr class="field"><th class="field-name">Exceptions :</th><td class="field-body"><ul class="first last simple">
2388
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.InvalidAccessErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">InvalidAccessErr</span></tt></a>:
2389
Raised if the attached property doesn’t
2390
support the float value or the unit type.</li>
2391
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.NoModificationAllowedErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">NoModificationAllowedErr</span></tt></a>:
2392
Raised if this property is readonly.</li>
2401
<dt id="cssutils.css.CSSPrimitiveValue.setStringValue">
2402
<tt class="descname">setStringValue</tt><big>(</big><em>stringType</em>, <em>stringValue</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSPrimitiveValue.setStringValue" title="Permalink to this definition">¶</a></dt>
2403
<dd><p>(DOM) A method to set the string value with the specified
2404
unit. If the property attached to this value can’t accept the
2405
specified unit or the string value, the value will be unchanged and
2406
a DOMException will be raised.</p>
2407
<table class="docutils field-list" frame="void" rules="none">
2408
<col class="field-name" />
2409
<col class="field-body" />
2410
<tbody valign="top">
2411
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
2412
<li><strong>stringType</strong> – a string code as defined above. The string code can only be a
2413
string unit type (i.e. CSS_STRING, CSS_URI, CSS_IDENT, and
2415
<li><strong>stringValue</strong> – the new string value
2416
Only the actual value is expected so for (CSS_URI, “a”) the
2417
new value will be <tt class="docutils literal"><span class="pre">url(a)</span></tt>. For (CSS_STRING, “‘a’”)
2418
the new value will be <tt class="docutils literal"><span class="pre">"\'a\'"</span></tt> as the surrounding <tt class="docutils literal"><span class="pre">'</span></tt> are
2419
not part of the string value</li>
2423
<tr class="field"><th class="field-name">Exceptions :</th><td class="field-body"><ul class="first last simple">
2424
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.InvalidAccessErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">InvalidAccessErr</span></tt></a>:
2425
Raised if the CSS value doesn’t contain a
2426
string value or if the string value can’t be converted into
2427
the specified unit.</li>
2428
<li><a class="reference external" href="http://docs.python.org/dev/library/xml.dom.html#xml.dom.NoModificationAllowedErr" title="(in Python v3.2)"><tt class="xref py py-exc docutils literal"><span class="pre">NoModificationAllowedErr</span></tt></a>:
2429
Raised if this property is readonly.</li>
2440
<div class="section" id="cssvaluelist">
2441
<h4><tt class="docutils literal"><span class="pre">CSSValueList</span></tt><a class="headerlink" href="#cssvaluelist" title="Permalink to this headline">¶</a></h4>
2443
<dt id="cssutils.css.CSSValueList">
2444
<em class="property">class </em><tt class="descclassname">cssutils.css.</tt><tt class="descname">CSSValueList</tt><big>(</big><em>cssText=None</em>, <em>parent=None</em>, <em>readonly=False</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSValueList" title="Permalink to this definition">¶</a></dt>
2445
<dd><p>The CSSValueList interface provides the abstraction of an ordered
2446
collection of CSS values.</p>
2447
<p>Some properties allow an empty list into their syntax. In that case,
2448
these properties take the none identifier. So, an empty list means
2449
that the property has the value none.</p>
2450
<p>The items in the CSSValueList are accessible via an integral index,
2451
starting from 0.</p>
2452
<dl class="attribute">
2453
<dt id="cssutils.css.CSSValueList.cssText">
2454
<tt class="descname">cssText</tt><a class="headerlink" href="#cssutils.css.CSSValueList.cssText" title="Permalink to this definition">¶</a></dt>
2455
<dd><p>A string representation of the current value.</p>
2458
<dl class="attribute">
2459
<dt id="cssutils.css.CSSValueList.cssValueTypeString">
2460
<tt class="descname">cssValueTypeString</tt><a class="headerlink" href="#cssutils.css.CSSValueList.cssValueTypeString" title="Permalink to this definition">¶</a></dt>
2461
<dd><p>(readonly) Name of cssValueType.</p>
2465
<dt id="cssutils.css.CSSValueList.item">
2466
<tt class="descname">item</tt><big>(</big><em>index</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSValueList.item" title="Permalink to this definition">¶</a></dt>
2467
<dd><p>(DOM) Retrieve a CSSValue by ordinal <cite>index</cite>. The
2468
order in this collection represents the order of the values in the
2469
CSS style property. If <cite>index</cite> is greater than or equal to the number
2470
of values in the list, this returns <tt class="xref docutils literal"><span class="pre">None</span></tt>.</p>
2473
<dl class="attribute">
2474
<dt id="cssutils.css.CSSValueList.length">
2475
<tt class="descname">length</tt><a class="headerlink" href="#cssutils.css.CSSValueList.length" title="Permalink to this definition">¶</a></dt>
2476
<dd><p>(DOM attribute) The number of CSSValues in the list.</p>
2479
<dl class="attribute">
2480
<dt id="cssutils.css.CSSValueList.seq">
2481
<tt class="descname">seq</tt><a class="headerlink" href="#cssutils.css.CSSValueList.seq" title="Permalink to this definition">¶</a></dt>
2482
<dd><p>Internal readonly attribute, <strong>DO NOT USE</strong>!</p>
2488
<div class="section" id="cssfunction">
2489
<h4><tt class="docutils literal"><span class="pre">CSSFunction</span></tt><a class="headerlink" href="#cssfunction" title="Permalink to this headline">¶</a></h4>
2491
<dt id="cssutils.css.cssvalue.CSSFunction">
2492
<em class="property">class </em><tt class="descclassname">cssutils.css.cssvalue.</tt><tt class="descname">CSSFunction</tt><big>(</big><em>cssText=None</em>, <em>parent=None</em>, <em>readonly=False</em><big>)</big><a class="headerlink" href="#cssutils.css.cssvalue.CSSFunction" title="Permalink to this definition">¶</a></dt>
2493
<dd><p>A CSS function value like rect() etc.</p>
2497
<div class="section" id="cssvariable">
2498
<h4><tt class="docutils literal"><span class="pre">CSSVariable</span></tt><a class="headerlink" href="#cssvariable" title="Permalink to this headline">¶</a></h4>
2500
<dt id="cssutils.css.CSSVariable">
2501
<em class="property">class </em><tt class="descclassname">cssutils.css.</tt><tt class="descname">CSSVariable</tt><big>(</big><em>cssText=None</em>, <em>parent=None</em>, <em>readonly=False</em><big>)</big><a class="headerlink" href="#cssutils.css.CSSVariable" title="Permalink to this definition">¶</a></dt>
2502
<dd><p>The CSSVariable represents a call to CSS Variable.</p>
2503
<dl class="attribute">
2504
<dt id="cssutils.css.CSSVariable.cssText">
2505
<tt class="descname">cssText</tt><a class="headerlink" href="#cssutils.css.CSSVariable.cssText" title="Permalink to this definition">¶</a></dt>
2506
<dd><p>A string representation of the current variable.</p>
2509
<dl class="attribute">
2510
<dt id="cssutils.css.CSSVariable.cssValueTypeString">
2511
<tt class="descname">cssValueTypeString</tt><a class="headerlink" href="#cssutils.css.CSSVariable.cssValueTypeString" title="Permalink to this definition">¶</a></dt>
2512
<dd><p>(readonly) Name of cssValueType.</p>
2515
<dl class="attribute">
2516
<dt id="cssutils.css.CSSVariable.seq">
2517
<tt class="descname">seq</tt><a class="headerlink" href="#cssutils.css.CSSVariable.seq" title="Permalink to this definition">¶</a></dt>
2518
<dd><p>Internal readonly attribute, <strong>DO NOT USE</strong>!</p>
2521
<dl class="attribute">
2522
<dt id="cssutils.css.CSSVariable.value">
2523
<tt class="descname">value</tt><a class="headerlink" href="#cssutils.css.CSSVariable.value" title="Permalink to this definition">¶</a></dt>
2524
<dd><p>Find contained sheet and @variables there</p>
2530
<div class="section" id="expressionvalue">
2531
<h4><tt class="docutils literal"><span class="pre">ExpressionValue</span></tt><a class="headerlink" href="#expressionvalue" title="Permalink to this headline">¶</a></h4>
2533
<dt id="cssutils.css.cssvalue.ExpressionValue">
2534
<em class="property">class </em><tt class="descclassname">cssutils.css.cssvalue.</tt><tt class="descname">ExpressionValue</tt><big>(</big><em>cssText=None</em>, <em>parent=None</em>, <em>readonly=False</em><big>)</big><a class="headerlink" href="#cssutils.css.cssvalue.ExpressionValue" title="Permalink to this definition">¶</a></dt>
2535
<dd><p>Special IE only CSSFunction which may contain <em>anything</em>.
2536
Used for expressions and <tt class="docutils literal"><span class="pre">alpha(opacity=100)</span></tt> currently.</p>
2537
<dl class="attribute">
2538
<dt id="cssutils.css.cssvalue.ExpressionValue.cssText">
2539
<tt class="descname">cssText</tt><a class="headerlink" href="#cssutils.css.cssvalue.ExpressionValue.cssText" title="Permalink to this definition">¶</a></dt>
2540
<dd><p>A string representation of the current value.</p>
2548
<div class="section" id="additional-info">
2549
<h2>Additional Info<a class="headerlink" href="#additional-info" title="Permalink to this headline">¶</a></h2>
2550
<p>Some classes in this package support standard Python idioms like iteration on certain attributes:</p>
2551
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">cssutils</span>
2552
<span class="gp">>>> </span><span class="n">sheet</span> <span class="o">=</span> <span class="n">cssutils</span><span class="o">.</span><span class="n">css</span><span class="o">.</span><span class="n">CSSStyleSheet</span><span class="p">()</span>
2553
<span class="gp">>>> </span><span class="n">sheet</span><span class="o">.</span><span class="n">cssText</span> <span class="o">=</span> <span class="s">'@charset "ascii";a { color: green }'</span>
2554
<span class="gp">>>> </span><span class="k">for</span> <span class="n">rule</span> <span class="ow">in</span> <span class="n">sheet</span><span class="p">:</span>
2555
<span class="gp">... </span> <span class="k">print</span> <span class="n">rule</span>
2556
<span class="gp">...</span>
2557
<span class="go"><cssutils.css.CSSCharsetRule object encoding='ascii' at 0x2ce7</span>
2558
<span class="go"><cssutils.css.CSSStyleRule object selector=u'a' style=u'color:</span>
2559
<span class="go">s=<cssutils.util._Namespaces object at 0x02CE7B30> at 0x2ce7d3</span>
2562
<p><tt class="docutils literal"><span class="pre">for</span> <span class="pre">in</span></tt> is supported by <a class="reference internal" href="#cssutils.css.CSSStyleSheet" title="cssutils.css.CSSStyleSheet"><tt class="xref py py-class docutils literal"><span class="pre">CSSStyleSheet</span></tt></a> and <a class="reference internal" href="#cssutils.css.CSSMediaRule" title="cssutils.css.CSSMediaRule"><tt class="xref py py-class docutils literal"><span class="pre">CSSMediaRule</span></tt></a> (iterating over the contained <a class="reference internal" href="#cssutils.css.CSSRule" title="cssutils.css.CSSRule"><tt class="xref py py-class docutils literal"><span class="pre">CSSRule</span></tt></a> objects, <a class="reference internal" href="#cssutils.css.CSSStyleDeclaration" title="cssutils.css.CSSStyleDeclaration"><tt class="xref py py-class docutils literal"><span class="pre">CSSStyleDeclaration</span></tt></a> (over the names of the contained <a class="reference internal" href="#cssutils.css.Property" title="cssutils.css.Property"><tt class="xref py py-class docutils literal"><span class="pre">Property</span></tt></a> objects), <a class="reference internal" href="#cssutils.css.CSSValueList" title="cssutils.css.CSSValueList"><tt class="xref py py-class docutils literal"><span class="pre">CSSValueList</span></tt></a> (over the <a class="reference internal" href="#cssutils.css.CSSValue" title="cssutils.css.CSSValue"><tt class="xref py py-class docutils literal"><span class="pre">CSSValue</span></tt></a> objects in the list).</p>
2570
<div class="sphinxsidebar">
2571
<div class="sphinxsidebarwrapper">
2572
<h3><a href="../index.html">Table Of Contents</a></h3>
2574
<li><a class="reference internal" href="#">Package <tt class="docutils literal"><span class="pre">cssutils.css</span></tt></a><ul>
2575
<li><a class="reference internal" href="#cssstylesheet"><tt class="docutils literal"><span class="pre">CSSStyleSheet</span></tt></a></li>
2576
<li><a class="reference internal" href="#css-rules">CSS rules</a><ul>
2577
<li><a class="reference internal" href="#cssrule"><tt class="docutils literal"><span class="pre">CSSRule</span></tt></a></li>
2578
<li><a class="reference internal" href="#cssrulelist"><tt class="docutils literal"><span class="pre">CSSRuleList</span></tt></a></li>
2579
<li><a class="reference internal" href="#csscharsetrule"><tt class="docutils literal"><span class="pre">CSSCharsetRule</span></tt></a></li>
2580
<li><a class="reference internal" href="#cssfontfacerule"><tt class="docutils literal"><span class="pre">CSSFontFaceRule</span></tt></a></li>
2581
<li><a class="reference internal" href="#cssimportrule"><tt class="docutils literal"><span class="pre">CSSImportRule</span></tt></a></li>
2582
<li><a class="reference internal" href="#cssmediarule"><tt class="docutils literal"><span class="pre">CSSMediaRule</span></tt></a></li>
2583
<li><a class="reference internal" href="#cssnamespacerule"><tt class="docutils literal"><span class="pre">CSSNamespaceRule</span></tt></a></li>
2584
<li><a class="reference internal" href="#csspagerule"><tt class="docutils literal"><span class="pre">CSSPageRule</span></tt></a></li>
2585
<li><a class="reference internal" href="#cssstylerule"><tt class="docutils literal"><span class="pre">CSSStyleRule</span></tt></a></li>
2586
<li><a class="reference internal" href="#cssvariablesrule"><tt class="docutils literal"><span class="pre">CSSVariablesRule</span></tt></a></li>
2587
<li><a class="reference internal" href="#csscomment"><tt class="docutils literal"><span class="pre">CSSComment</span></tt></a></li>
2590
<li><a class="reference internal" href="#selector-related-classes-selectorlist-and-selector">Selector related classes: <tt class="docutils literal"><span class="pre">SelectorList</span></tt> and <tt class="docutils literal"><span class="pre">Selector</span></tt></a><ul>
2591
<li><a class="reference internal" href="#selectorlist"><tt class="docutils literal"><span class="pre">SelectorList</span></tt></a></li>
2592
<li><a class="reference internal" href="#selector"><tt class="docutils literal"><span class="pre">Selector</span></tt></a></li>
2595
<li><a class="reference internal" href="#style-related-classes-cssstyledeclaration-property-cssvalue-etc">Style related classes: <tt class="docutils literal"><span class="pre">CSSStyleDeclaration</span></tt>, <tt class="docutils literal"><span class="pre">Property</span></tt>, <tt class="docutils literal"><span class="pre">CSSValue</span></tt> etc</a><ul>
2596
<li><a class="reference internal" href="#cssvariablesdeclaration"><tt class="docutils literal"><span class="pre">CSSVariablesDeclaration</span></tt></a></li>
2597
<li><a class="reference internal" href="#cssstyledeclaration"><tt class="docutils literal"><span class="pre">CSSStyleDeclaration</span></tt></a></li>
2598
<li><a class="reference internal" href="#property"><tt class="docutils literal"><span class="pre">Property</span></tt></a></li>
2599
<li><a class="reference internal" href="#values">Values</a><ul>
2600
<li><a class="reference internal" href="#cssvalue"><tt class="docutils literal"><span class="pre">CSSValue</span></tt></a></li>
2601
<li><a class="reference internal" href="#cssprimitivevalue"><tt class="docutils literal"><span class="pre">CSSPrimitiveValue</span></tt></a></li>
2602
<li><a class="reference internal" href="#cssvaluelist"><tt class="docutils literal"><span class="pre">CSSValueList</span></tt></a></li>
2603
<li><a class="reference internal" href="#cssfunction"><tt class="docutils literal"><span class="pre">CSSFunction</span></tt></a></li>
2604
<li><a class="reference internal" href="#cssvariable"><tt class="docutils literal"><span class="pre">CSSVariable</span></tt></a></li>
2605
<li><a class="reference internal" href="#expressionvalue"><tt class="docutils literal"><span class="pre">ExpressionValue</span></tt></a></li>
2610
<li><a class="reference internal" href="#additional-info">Additional Info</a></li>
2615
<h4>Previous topic</h4>
2616
<p class="topless"><a href="serialize.html"
2617
title="previous chapter">serializing CSS</a></p>
2619
<p class="topless"><a href="stylesheets.html"
2620
title="next chapter">Package <tt class="docutils literal"><span class="pre">cssutils.stylesheets</span></tt></a></p>
2622
<ul class="this-page-menu">
2623
<li><a href="../_sources/docs/css.txt"
2624
rel="nofollow">Show Source</a></li>
2626
<div id="searchbox" style="display: none">
2627
<h3>Quick search</h3>
2628
<form class="search" action="../search.html" method="get">
2629
<input type="text" name="q" size="18" />
2630
<input type="submit" value="Go" />
2631
<input type="hidden" name="check_keywords" value="yes" />
2632
<input type="hidden" name="area" value="default" />
2634
<p class="searchtip" style="font-size: 90%">
2635
Enter search terms or a module, class or function name.
2638
<script type="text/javascript">$('#searchbox').show(0);</script>
2641
<div class="clearer"></div>
2643
<div class="related">
2646
<li class="right" style="margin-right: 10px">
2647
<a href="../genindex.html" title="General Index"
2650
<a href="../py-modindex.html" title="Python Module Index"
2653
<a href="stylesheets.html" title="Package cssutils.stylesheets"
2656
<a href="serialize.html" title="serializing CSS"
2657
>previous</a> |</li>
2658
<li><a href="../index.html">cssutils v0.9.7b4 documentation</a> »</li>
2661
<div class="footer">
2662
© Copyright 2004-2010, Christof Höke.
2663
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.4.
b'\\ No newline at end of file'