Cssutils

Latest version: v2.11.1

Safety actively analyzes 683530 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 17 of 21

0.9.3a1

Not secure
- FEATURE: Implemented css.CSSValue, css.CSSPrimitiveValue and css.CSSValueList.

Not yet implemented are:
- css.CSSPrimitiveValue.getCounterValue and css. Counter
- css.CSSPrimitiveValue.getRGBColorValue and css.RGBColor
- css.CSSPrimitiveValue.getRectValue and css.Rect

+ FEATURE: css.CSSValueList is iterable so may be used in a for loop
+ FEATURE: CSSValue has property ``cssValueTypeString`` which is the name of the relevant ``cssValueType``, e.g. "CSS_PRIMITIVE_TYPE". Mainly useful for debugging.
+ FEATURE: CSSPrimitiveValue has property ``primitiveTypeString`` which is the name of the relevant ``primitiveType``, e.g. "CSS_PX". Mainly useful for debugging.
+ CSSValue has an init Parameter ``_propertyname`` to set a context property for validation. If none is set the value is always invalid. **THIS MAY CHANGE!**

- FEATURE (**experimental**): CSSStyleDeclaration is iterable now. The iterator returns *all* properties set in this style as objects with properties ``name``, ``cssValue`` and ``priority``. Calling CSSStyleDeclaration.item(index) on the other hand simply returns a property name and also only the normalized name (once). Example::

sheet = cssutils.parseString('a { color: red; c\olor: blue; left: 0 !important }')
for rule in sheet.cssRules:
style = rule.style
for property in style:
name = property.name
cssValue = property.cssValue
priority = property.priority
print name, '=', cssValue.cssText, priority

prints:
color = red
c\olor = blue
left = 0 !important

for i in range(0, style.length):
name = style.item(i)
cssValue = style.getPropertyCSSValue(name)
priority = style.getPropertyPriority(name)
print name, '=', cssValue.cssText , priority

prints:
color = blue
left = 0 !important

**ATTENTION**: This has been changed in 0.9.5, see details there!

- FEATURE (**experimental**): added ``CSSStyleSheet.replaceUrls(replacer)`` which may be used to adjust all "url()" values in a style sheet (currently in CSSStyleDeclaration and CSSImportRules).

- FEATURE: added ``CSSStyleDeclaration.getCssText(separator=None)`` which returns serialized property cssText, each property separated by given ``separator`` which may e.g. be u'' to be able to use cssText directly in an HTML style attribute. ";" is always part of each property (except the last one) and can **not** be set with separator!

- FEATURE: ``href`` and ``media`` arguments can now be passed to ``parse()`` and ``parseString()`` functions and methods. This sets the appropriate attributes on the generated stylesheet objects.

- FEATURE: CSSMediaRule has an init parameter ``mediaText`` synchronous to CSSImportRule now

- FEATURE: The ``MediaList`` constructor can now be passed a list of media types.

- FEATURE: ``CSSRule`` and subclasses have a property ``typeString`` which is the name of the relevant ``type``, e.g. ``STYLE_RULE``. Mainly useful for debugging.

- FEATURE: ``cssutils.serialize.Preferences`` has a new option ``lineSeparator`` that is used as linefeed character(s). May also be set to ``u''`` for ``CSSStyleDeclareation.cssText'`` to be directly usable in e.g. HTML style attributes

+ API CHANGE (internal): renamed serializers method ``do_stylesheet`` to ``do_CSSStyleSheet``

- BUGFIX (Bitbucket 9): Parsing of empty ``url()`` values has been fixed
- BUGFIX: Handling of linenumbers in the serializer has been fixed.
- BUGFIX (minor): removed debug output in CSSStyleDeclaration

+ CHANGE (experimental!): CSSStyleDeclaration.getPropertyCSSValue() for shorthand properties like e.g. ``background`` should return None. cssutils returns a CSSValueList in these cases now. Use with care as this may change later

+ CHANGE: CSSValue default cssText is now ``u""`` and not ``u"inherit"`` anymore

+ CHANGE: ``css.CSSStyleDeclaration.cssText`` indents its property not anymore.

+ CHANGE: ``cssutils.serialize.CSSSerializer`` has been refactored internally to support the lineSeparator option.

+ CHANGE: The Selector and SameNamePropertyList (which might be renamed as it is experimental) class are now available from cssutils.css too.

**UPDATE: SameNamePropertyList removed in 0.9.4**

+ CHANGE: Tokenizer strips HTML comment tokens CDO and CDC from tokenlist now.

+ CHANGE: Added __repr__ and __str__ methods to most classes. __str__ reports e.g. ``<cssutils.css.CSSImportRule object href=None at 0xaaa870>``, __repr__ e.g. ``cssutils.css.CSSImportRule(href=None, mediaText=u'all')`` which is a valid contructor for the object in most cases (which might not be complete for all init parameter for all classes like in this case though). The following details are included:

css
- CSSStyleSheet shows the title and href
- CSSCharsetRule shows the encoding
- CSSCharsetRule shows the cssText (not in __str__ though)
- CSSImportRule shows the href and the MediaList mediaText
- CSSMediaRule shows the MediaList mediaText
- CSSNameSpaceRule shows the prefix and uri
- CSSPageRule shows the selectorText
- CSSStyleRule shows the selectorText
- CSSUnknownRule shows nothing special
- CSSStyleDeclaration shows the number of properties set for __str__ but an empty CSSStyleDeclaration constructor for __repr__ as showing cssText might be way too much
- SameNamePropertyList shows the name
- CSSValue, CSSPrimitiveValue show the actual value for __repr__, some details for __str__
- CSSValueList shows an __repr__ which is **not** possible to ``eval()`` and some details for __str__
- _Property shows infos but should be used directly for now anyway!
- Selector the selectorText

stylesheets
- MediaList shows the mediaText

0.9.2b3

Not secure
- FEATURE: Script ``cssparse`` handles more than one file at a time now (patch from Issue Bitbucket 6 by Walter Doerwald)

- BUGFIX: Fixed Issue Bitbucket 7: typo gave AssertionError for selectors like ``tr:nth-child(odd) td{}``
- BUGFIX: Fixed Issue Bitbucket 5: false warning for certain values for ``background-position`` removed
- BUGFIX: Report of line/col for any node was not correct if a node contained line breaks itself

- Quite a few internal optimizations (thanks to Walter Doerwald)
- Added tests for issues Bitbucket 3 and Bitbucket 4 to tokenizer too

0.9.2b2

- BUGFIX: Fixed Issue Bitbucket 4, tokenizing of color values like ``Bitbucket 00a`` was buggy (mixture of numbers and characters). Also warnings of invalid property values should be more reliable now (regexes in ``css.cssproperties`` changed).

0.9.2b1

- BUGFIX: Fixed Issue Bitbucket 3, WS was not handled properly if added to token list by tokenizer

0.9.2a5

- BUGFIX: Unexpected end of style sheet now handled according to spec for most cases, e.g. incomplete CSSStyleRule, CSSMediaRule, CSSImportRule, CSSNamespaceRule, CSSPageRule.

0.9.2a4

- BUGFIX (major): no changes to the library, but fixed setup of source dist

Page 17 of 21

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.