Cssutils

Latest version: v2.11.1

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

Scan your dependencies

Page 16 of 21

0.9.5a1

Not secure
+ **API CHANGE**: ``Property.name`` is now the same as ``Property.normalname`` which is DEPRECATED now. To access the literal name (the value which was available in ``name`` until now) use ``Property.literalname``. For most cases where a property name is used the new behaviour makes more sense, therefor the change.

**Do not use ``normalname`` anymore, it will probably be removed for release 1.0.**

NEW since 0.9.5::

p = Property(ur'c\olor', 'red')
p.name == ur'color'
p.literalname == ur'c\olor'
DEPRECATED: p.normalname == ur'color'

OLD until 0.9.5::

p = Property(ur'c\olor', 'red')
p.name == ur'c\olor'
p.normalname == ur'color'

+ **API CHANGE**: iterating over ``css.CSSStyleDeclaration`` yields now *effective* properties only and not *all* properties set in the declaration. E.g. from ``color: red; c\olor: green`` only one Property is returned which has the value ``green``. To retrieve *all* properties use ``CSSStyleDeclaration.getProperties(all=True)``. Reason for this change is that for most cases the new default makes more sense.

- **FEATURE**: ``css.CSSStyleDelcaration`` supports ``in`` now. Expected is a Property or a name of a property which is checked if already in the style declaration

- **FEATURE**: ``css.Selector`` has a **readonly** property ``specificity`` now which is calculated as described at http://www.w3.org/TR/css3-selectors/#specificity

**ATTENTION**: changing the Selector by changing its property ``seq`` does **not** update the specificity! ``Selector.seq.append`` has been made private therefor and writing to ``seq`` **not** be used at all!

- **FEATURE**: Added ``css.CSSStyleDeclaration.getProperty(name, normalize=True)`` which returns the effective Property object for ``name``.

- FEATURE: Implemented http://csswg.inkedblade.net/spec/css2.1#issue-23, URI may be ``URL(...)`` or ``u\r\6c(...)`` now

+ **BUGFIX**: ``CSSStyleDeclaration.removeProperty(name, normalize=True)`` removes all properties with given ``name`` now and returns the effective value. If ``normalize==False`` removes only properties with ``name=Property.literalname`` and also only returns the effective value of the unnormalized name.

+ **BUGFIX**: Priority of Properties is acknowledged by all methods of ``css.CSSStylesDeclaration`` now.

+ **BUGFIX**: Fixed serializing of strings like "\\a", "\\22" and '\\27' in import urls, selectors and values. **func("string") is not yet fixed!!!**

- CHANGE: ``CSSValueList`` does not emit warnings for shorthand properties anymore. Nevertheless these may be invalid!

- IMPROVEMENT: ``CSSStyleDeclaration`` and some minor other parts refactored

0.9.4b1

Not secure
- **FEATURE**: Added ``csscombine`` script which currently resolves import rules into the input sheet. No nested imports are resolved yet and namespace rules do not work yet though!

- FEATURE: ``css.CSSStyleSheet.insertRule(rule, index)`` accepts now a ``css.CSSRuleList`` in addition to a ``css.CSSRule`` object or a CSS string. Useful if you like a combine a complete sheet into an existing one.

+ **BUGFIX**: Serializing escape sequences add a single SPACE after each escape. This was not present until now so a sequence like "\\74 a" did come out as "\\000074a" which was not as intended. Also as a SPACE is inserted in any case all escapes are not padded to 6 digits anymore but are only as long as needed.

+ **BUGFIX**: Handling of illegal selectors is now same as the W3C CSS validator (and according the selector spec - I hope ;). Illegal selectors result the complete rule being dropped. Fixed are the following (edge) cases:

``a/**/b``
Meant was probably a space between a and b (plus maybe the comment) but it MUST be inserted. IE and Safari nevertheless seem to parse this rule as ``a b`` so as if a space would be present. cssutils now parses this selector as intented by the spec as ``ab``.
``a*b``
Again spaces around the UNIVERSAL ``*`` were probably meant by the author. IE and Safari seem to parse this **invalid** selector as ``a b``. cssutils ignores this rule completely!

+ BUGFIX: ``css.CSSRuleList`` is still a Python list but setting methods like ``__init__``, ``append``, ``extend`` or ``__setslice__`` are added later on instances of this class if so desired. E.g. CSSStyleSheet adds ``append`` which is not available in a simple instance of this class! This has been changed as no validation is possible in CSSRuleList itself.

- CHANGE: Unknown media type in a MediaQuery (e.g. ``media tv, radio``) does emit WARNING instead of ERROR now.

+ IMPROVEMENT: Added better ``str`` and ``repr`` to cssutils.serializer.Preferences

+ IMPROVEMENT: Added position information to some error reportings (Property, CSSMediaRule

0.9.4a4

Not secure
- **FEATURE**: Implemented ``css.CSSFontFaceRule``.

- **FEATURE**: Added ``css.CSSStyleSheet.encoding`` which reflects the encoding of an explicit charset rule. Setting the property to ``None`` removes an charset rule if present and sets the encoding to the default value 'utf-8'. Setting a value of ``utf-8`` sets the encoding to the default value too but the charset rule is explicitly added.

Effectively this removes the need to use ``css.CSSCharsetRule`` directly as using this new property is easier and simpler.

(A suggestion in the `CSSOM <http://dev.w3.org/csswg/cssom/#the-csscharsetrule>`_ but not yet resolved. IMHO it does make sense so it is present in cssutils. ``css.CSSCharsetRule`` remains though if you really *want* to use it).

+ **BUGFIX/IMPROVEMENT**: ``css.SelectorList`` and ``stylesheets.MediaList`` have (Python) list like behaviour partly but are *directly not lists anymore* (which did not work properly anyway...). The following list like possibilities are implemented for now:

- ``item in x`` => bool
- ``len(x)`` => integer
- get, ``del`` and set ``x[i]``
- ``for item in x``
- ``x.append(item)``

The DOM additional methods and properties like ``length`` or ``item()`` are still present (and also will be in the future) but the standard Python idioms are probably easier to use.

``stylesheets.StyleSheetList`` and ``css.CSSRuleList`` are the only direct lists for now. This may change in the future so it is safer to also use the above possibilities only for now.

+ BUGFIX: Fixed handling of "\\ " (an escaped space) in selectors and values.

+ BUGFIX: ``!important`` is normalized (lowercase) now

- IMPROVEMENT: Some error messages have been changed slightly, mostly values are given with their Python representation and not the actual values.
- IMPROVEMENT: The setup process of cssutils has been adapted to suggestions at http://jimmyg.org/2007/11/08/creating-a-python-package-using-eggs-and-subversion/

+ DOCS: Slight overhaul of docs.

0.9.4a3

Not secure
+ CSSCapture:
+ **FEATURE**: Added option ``-m, --minified`` to CSSCapture which saves the retrieved CSS files with the cssutils serializer setting ``Preferences.useMinified()``.

- **BUGFIX**: option '-p' of csscapture is removed as it was not used anyway. A new option ``-r, --saveraw`` has been added which defaults to ``False``. If given saves raw css otherwise cssutils' parsed files.
- **BUGFIX**: CSSCapture now uses the ``cssutils.parseString`` method so invalid sheets should be saved too. Until now in case of an error the sheet was not saved at all.

- **BUGFIX/FEATURE**: Handling of unicode escapes should now work propertly.

The tokenizer resolves any unicodes escape sequences now so cssutils internally simple unicode strings are used.

The serializer should serialize a CSSStyleSheet properly escaped according to the relevant encoding defined in an charset rule or defaulting to UTF-8. Characters not allowed in the current encoding are escaped the CSS way with a backslash followed by a uppercase 6 digit hex code point (**always 6 digits** to make it easier not to have to check if no hexdigit char is following).

This *FEATURE* was not present in any older version of cssutils.

- **BUGFIX**: Names (of properties or values) which are normalized should be properly normalized now so simple escapes like ``c\olor`` but also unicode escapes like ``\43olor`` should result in the property name ``color`` now

- **BUGFIX**: Selector did fail to parse negation ``:not(`` correctly
- **BUGFIX**: CSSValueList treated a value like ``-1px`` as 2 entries, now they are correctly 1.
- **BUGFIX**: Validation of values for ``background-position`` was wrong.
- **BUGFIX**: ``CSSPrimitiveValue.primitiveValue`` was not recognized properly if e.g. a CSS_PX was given as '1PX' instead of '1px'.
- **BUGFIX/CHANGE**: Reporting of line numbers should have improved as ``\n`` is now used instead of ``os.linesep``.

+ **CHANGE**: Invalid Properties like ``$top`` which some UAs like Internet Explorer still are use are preserved. This makes the containing Property and CSSStyleDeclaration invalid (but still *wellformed* although they technically are not) so if the serializer is set to only output valid stuff they get stripped anyway.

**This may change and also simply may be put in a cssutils wide "compatibility mode" feature.**

+ **CHANGE**: If a CSSValue cannot be validated (no property context is set) the message describing this is set to DEBUG level now (was INFO).

+ IMPROVEMENT: "setup.py" catches exception if setuptools is not installed and emits message

- DOCS: Added more documentation and also a standalone HTML documentation which is generated from the SVN RST docs.

0.9.4a2

Not secure
- **FEATURE**: added ``Preferences.useMinified()`` which sets preferences that a stylesheet will be serialized as compact as possible. Added ``Preferences.useDefaults()`` which resets the serializer preferences. There a few new preferences have been added as well (see the documentation for details as most are hardly useful for normal usage of the library)

+ **BUGFIX**: Fixed parsing of ``font`` value which uses "font-size/line-height" syntax.

- CHANGE: ``Preferences.keepAllProperties`` defaults to ``True`` now (hardly used but safer if different values have been set which are used by different UAs for example.)

0.9.4a1

- **FEATURE**: Added a new module ``cssutils.codec`` that registers a codec that can be used for encoding and decoding CSS. (http://www.w3.org/TR/2006/WD-CSS21-20060411/syndata.html#q23)

- **FEATURE**: Added implementation of ``stylesheets.MediaQuery`` which are part of stylesheets.MediaList. See the complete spec at http://www.w3.org/TR/css3-mediaqueries/ for details.

Not complete yet: Properties of MediaQueries are not validated for now and maybe some details are missing

- FEATURE: Implemented ``cssutils.DOMImplementationCSS``. This way it is possible to create a new StyleSheet by calling ``DOMImplementationCSS.createCSSStyleSheet(title, media)``. For most cases it is probably easier to make a new StyleSheet by getting an instance of ``cssutils.css.CSSStyleSheet`` though.

- FEATURE: cssutils is registered to ``xml.dom.DOMImplementation`` claiming to implement CSS 1.0, CSS 2.0, StyleSheets 1.0 and StyleSheets 2.0. This is probably not absolutely correct as cssutils currently is not a fully compliant implementation but I guess this is used very rarely anyway.

+ **API CHANGE**: ``CSSNamespacerule.uri`` is renamed to ``CSSNamespaceRule.namespaceURI`` which is defined is CSSOM. ``uri`` is deprecated and still available but the constructor parameter is named ``namespaceURI`` in any case now.

+ **API CHANGE**: As ``stylesheets.MediaQuery`` is implemented now all classes using an instance of ``stylesheets.MediaList`` are presented slightly different. Until now a simple list of string was given, now the list contains MediaQuery objects.

+ **API CHANGE**: ``_Property`` has been renamed to ``css.Property`` and is used in context of ``CSSStyleDeclaration`` and ``MediaQuery``. Attribute ``Property.value`` has been *de-deprecated* and may be used normally now (again). The Property constructor has only optional parameters now.

+ **API CHANGE**: Removed experimental class ``SameNamePropertyList`` which was used in ``CSSStyleDeclaration`` and also method ``CSSStyleDeclaration.getSameNamePropertyList``. A new method ``CSSStyleDeclaration.getProperties()`` has been added which is simpler and more useful

+ **API CHANGE**: renamed attribute ``namespaces`` of CSSStyleSheet and Selector to ``prefixes`` as they really are the prefixes of declared namespaces

- API CHANGE (internal): renamed ``Serializer.do_css_Property`` to ``Serializer.do_Property`` as it is ``Property`` is not in the official DOM, may not stay in package ``css`` and is used by MediaQuery too

- API CHANGE (internal): renamed ``Serializer.do_CSSvalue`` to ``Serializer.do_CSSValue``

+ BUGFIX: Tantek hack (using ``voice-family``) should work now as SameNamePropertyList is removed and properties are kept in order

+ BUGFIX: Token CHARSET_SYM is now as defined in the CSS 2.1 Errata as literal "charset " including the ending space.

- **CHANGE**: A completely new tokenizer and mostly also the parser have been reimplemented in this release. Generally it should be much more robust and more compliant now. It will have new errors and also some slight details in parsing are changed.

+ **DOCS**: Added some docs in reStructuredText format including a basic server to view it as HTML. The HTML may be published as well.

Page 16 of 21

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.