Package cssutils :: Package stylesheets :: Module stylesheet
[hide private]
[frames] | no frames]

Source Code for Module cssutils.stylesheets.stylesheet

  1  """ 
  2  StyleSheet implements DOM Level 2 Style Sheets StyleSheet. 
  3  """ 
  4  __all__ = ['StyleSheet'] 
  5  __docformat__ = 'restructuredtext' 
  6  __version__ = '$Id: stylesheet.py 1152 2008-03-18 22:36:39Z cthedot $' 
  7   
  8  import urlparse 
  9  import cssutils 
 10   
11 -class StyleSheet(cssutils.util.Base):
12 """ 13 The StyleSheet interface is the abstract base interface 14 for any type of style sheet. It represents a single style 15 sheet associated with a structured document. 16 17 In HTML, the StyleSheet interface represents either an 18 external style sheet, included via the HTML LINK element, 19 or an inline STYLE element (-ch: also an @import stylesheet?). 20 21 In XML, this interface represents 22 an external style sheet, included via a style sheet 23 processing instruction. 24 """
25 - def __init__(self, type='text/css', 26 href=None, 27 media=None, 28 title=u'', 29 disabled=None, 30 ownerNode=None, 31 parentStyleSheet=None):
32 """ 33 type: readonly 34 This specifies the style sheet language for this 35 style sheet. The style sheet language is specified 36 as a content type (e.g. "text/css"). The content 37 type is often specified in the ownerNode. Also see 38 the type attribute definition for the LINK element 39 in HTML 4.0, and the type pseudo-attribute for the 40 XML style sheet processing instruction. 41 href: readonly 42 If the style sheet is a linked style sheet, the value 43 of this attribute is its location. For inline style 44 sheets, the value of this attribute is None. See the 45 href attribute definition for the LINK element in HTML 46 4.0, and the href pseudo-attribute for the XML style 47 sheet processing instruction. 48 media: of type MediaList, readonly 49 The intended destination media for style information. 50 The media is often specified in the ownerNode. If no 51 media has been specified, the MediaList will be empty. 52 See the media attribute definition for the LINK element 53 in HTML 4.0, and the media pseudo-attribute for the XML 54 style sheet processing instruction. Modifying the media 55 list may cause a change to the attribute disabled. 56 title: readonly 57 The advisory title. The title is often specified in 58 the ownerNode. See the title attribute definition for 59 the LINK element in HTML 4.0, and the title 60 pseudo-attribute for the XML style sheet processing 61 instruction. 62 disabled: False if the style sheet is applied to the 63 document. True if it is not. Modifying this attribute 64 may cause a new resolution of style for the document. 65 A stylesheet only applies if both an appropriate medium 66 definition is present and the disabled attribute is False. 67 So, if the media doesn't apply to the current user agent, 68 the disabled attribute is ignored. 69 ownerNode: of type Node, readonly 70 The node that associates this style sheet with the 71 document. For HTML, this may be the corresponding LINK 72 or STYLE element. For XML, it may be the linking 73 processing instruction. For style sheets that are 74 included by other style sheets, the value of this 75 attribute is None. 76 parentStyleSheet: of type StyleSheet, readonly 77 For style sheet languages that support the concept 78 of style sheet inclusion, this attribute represents 79 the including style sheet, if one exists. If the style 80 sheet is a top-level style sheet, or the style sheet 81 language does not support inclusion, the value of this 82 attribute is None. 83 """ 84 super(StyleSheet, self).__init__() 85 86 self._href = href 87 self._ownerNode = ownerNode 88 self._parentStyleSheet = parentStyleSheet 89 self._type = type 90 91 self.disabled = bool(disabled) 92 self.media = media 93 self.title = title
94 95 href = property(lambda self: self._href) 96 97 ownerNode = property(lambda self: self._ownerNode) 98 99 parentStyleSheet = property(lambda self: self._parentStyleSheet) 100 101 type = property(lambda self: self._type, doc=u'Default: "ext/css"')
102