Cssutils

Latest version: v2.11.1

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

Scan your dependencies

Page 18 of 21

0.9.2a3

- no changes to the library, just optimized setuptools dist

0.9.2a2

- API CHANGE: removed cssutils.util.normalize function, use static (but private!) method cssutils.util.Base._normalize if absolutely needed which may be change too though
- API CHANGE (minor): removed ``getFormatted`` and pprint`` from various classes which were both DEPRECATED for some time anyway
- API CHANGE (minor): _Property.value is DEPRECATED, use _Property.cssValue.cssText instead, _Property is defined as private anyway so should not be used directly
- API CHANGE (minor): removed ``Tokenizer.tokensupto`` which was used internally only

- CHANGE: Numbers and Dimensions starting with "." like ".1em" in the original stylesheet will be output as "0.1em" with a proceding 0 now.
- CHANGE: Report of parsing errors have a slightly different syntax now.

- FEATURE: New ``Preferences.omitLastSemicolon`` option. If ``True`` omits ; after last property of CSSStyleDeclaration

- BUGFIX: The css validator definition for "num" was wrong, so values like ``-5.5em`` would issue a warning but should be correct
- BUGFIX: Dimension were not parsed correcly so 1em5 was parsed a "1em" + 5 which should really be one "1em5" were "em5" is an unknown dimension. This had probably no effect on current stylesheets but was a tokenizing error
- BUGFIX: Parsing of nested blocks like {}, [] or () is improved
- BUGFIX: Comment were not parsed correctly, now ``/*\*/`` is a valid comment
- BUGFIX: ``css.Selector`` had a warning which called "warning" which in fact is named "warn". Some other error messages gave token list instead of a more useful string in case of an error, that is fixed as well (CSSComment and CSSValue).

- IMPROVEMENT: Line number are still not given for all errors reported but for at least some more now
- IMPROVEMENT: Performance of the tokenizer has been improved, it is now about 20% faster (testing the unittests) which may not hold for all usages but is not too bad as well ;)

0.9.2a1

- FEATURE: Partly Implemented css.CSS2Properties so you can now use::

>>> sheet = cssutils.parseString('a { font-style: italic; }')
>>> style = sheet.cssRules[0].style
>>> style.fontStyle = 'normal'
>>> print style.fontStyle
normal

Each property can be retrieved from CSSStyleDeclaration object with its name as
an object property. Names with "-" in it like ``font-style`` need to be called by
the respective DOM name ``fontStyle``.
Setting a property value works the same way and even ``del`` which effectively removes a property from a CSSStyleDeclaration works. For details see CSSStyleDeclaration.

Not implemented are the finer details, see the module documentation of
cssutils.css.cssproperties.

- BUGFIX: CSSStyleDeclaration.getPropertyCSSValue returns None for all shorthand properties

- refactored some parts and added more tests

0.9.1b3

- **CHANGE** for Serializer preference options:

new name
+ ``defaultAtKeyword`` instead of ``normalkeyword``
+ ``defaultPropertyName`` instead of ``normalpropertyname``

camelcase now:
+ ``keepComments`` instead of ``keepComments``
+ ``lineNumbers`` instead of ``linenumbers``

replaced (see below)
+ ``keepAllProperties`` instead of ``keepsimilarnamedproperties``

- FEATURE: ``Serializer.prefs.keepAllProperties`` replaces `` ``keepsimilarnamedproperties``:
if ``True`` all properties given in the parsed CSS are kept.
This may be useful for cases like::

background: url(1.gif) fixed;
background: url(2.gif) scroll;

Certain UAs may not know fixed and will therefor ignore property 1 but
an application might simply like to prettyprint the stylesheet without
loosing any information.

Defaults to ``False``.

See examples/serialize.py for an usage example.

- FEATURE(experimental, might change!):
``CSSStyleDeclaration.getSameNamePropertyList(name)``
Experimental method to retrieve a SameNamePropertyList object which
holds all Properties with the given ``name``. The object has an
attribute ``name`` and a list of Property objects each with an actual name,
value and priority.

**UPDATE: SameNamePropertyList removed in 0.9.4**

``CSSStyleDeclaration.setProperty`` has a new positional parameter
``overwrite`` which defines if the property which is set overwrites any former
value (or values, see ``getSameNamePropertyList``) (default behaviour) or the
given value is appended to any former value (overwrite=False).
Useful for cases where a property should have different values for different UAs.

Example 1: CSS hacks::

width: 100px; /* wrong box model value for IE5-5.5 */
padding: 5px;
w\idth: 90px; /* correct box model value for later browsers */

Example 2: UA capabilities::

background: url(2.gif) scroll; /* Fallback for UA which do not understand fixed */
background: url(1.gif) fixed; /* UA which do know fixed */

- FEATURE: Reimplemented csscapture, which uses the new serializer preference ``keepAllProperties``

- BUGFIX(major!): Serializer outputs actual property depending on Property priority out now
see ``examples/serialize.py``

- BUGFIX(minor): Parameter ``name`` for `CSSStyleDeclaration.XXX(name)``
is normalized now, so ``color``, ``c\olor`` and ``COLOR`` are all equivalent

0.9.1b2

- FEATURE: added ``Serializer.prefs.keepsimilarnamedproperties``:
if ``True`` all properties with the same normalname but different
actual names are kept, e.g. color, c\olor, co\lor.
This is mainly useful to keep a stylesheet complete which uses
xbrowser hacks as above.

**UPDATE IN 0.9.1b3!**

- BUGFIX (minor): ``Serializer.prefs.normalpropertyname`` did not work properly if a property was set 2 times in the same declaration, e.g. ``color: red;c\olor: green`` setting the pref to ``False`` results in ``c\olor: green`` now.
- BUGFIX (minor): Serializing of CSSStyleDeclaration did not work well when CSSComments were mixed with Properties.

0.9.1b1

- FUTURE CHANGE: ``readonly`` will be removed from most rules. It is not used anyway, may be readded in a future release

- CHANGE: order of constructor parameters changed in ``CSSImportRule``. Should be no problem as positional parameters are discouraged anyway
- CHANGE: cssutils needs Python 2.4 from the release on as it uses the buildin ``set``
- CHANGE: removed ``CSSMediaRule.addRule`` which was deprecated anyway

- FEATURE: implemented page CSSRule including testcases
- FEATURE: implemented namespace CSSRule according to http://www.w3.org/TR/2006/WD-css3-namespace-20060828/ with the following changes
* the url() syntax is not implemented as it may (?) be deprecated anyway
* added namespace parsing to ``Selector``, see http://www.w3.org/TR/css3-selectors/
* CSSStyleSheet checks if all namespaces in CSSStyleRules have been declared with CSSNamespaceRules. If not the rule's ``valid`` property is set to ``False`` and the serializer omits it (you may change ``Preferences.removeInvalid`` to change this behaviour).
* CSSStyleSheet and Selector object have a new propery ``namespaces`` which currently contain declared and used namespace prefixes (!), this may change in the future so use with care if at all.
- FEATURE: implemented ``CSSRule.parentStyleSheet`` for all rules
- FEATURE: implemented ``CSSRule.parentRule`` for relevant rules (all allowed in media)

- BUGFIX: Set ``parentStyleSheet`` and ``parentRule`` as instance vars in ``css.CSSRule`` instead as class vars
- BUGFIX: CSSComment raised exception if setting cssText with empty string - fixed

- DOCS: generated docs with epydoc which are then included in src dist. Source documentation is cleaned up a bit.

- INTERNAL: Refactored some unittests
- INTERNAL: implementation based on `DOM Level 2 Style Recommendation <http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/>`_ as opposed to the `Proposed Recommendation <http://www.w3.org/TR/2000/PR-DOM-Level-2-Style-20000927/>`_ now. As there are no main changes I could find this does not make any difference...

Page 18 of 21

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.