jabapyth/css — Issue #3: invalid parsed selector, question about url() and built-in types
Author: tkloc
Created: 2012-02-06 11:04:29+00:00
State: open

Hello,

I'm using css lib to parse styles uploaded by users and then do some validation rules. First problem is about inproperly parsed selectors, for example:

```
#editTemporaryPriceList,
#addTemporaryPriceList,
#addPriceList { font-size: 1.2em; display: block; color: #333; text-decoration: underline; margin-top: 10px; padding-bottom: 3px; }
```

is parsed as:

```
(None, {'pseudo': [], 'attrib': [], 'hash': ['editTemporaryPriceList'], 'class': []})
(None, {'pseudo': [], 'attrib': [], 'hash': ['#addTemporaryPriceList'], 'class': []})
(None, {'pseudo': [], 'attrib': [], 'hash': ['#addPriceList'], 'class': []})
```
(# at the begging of 'hash' in two selectors)

The second problem is about attributes with url(). Why url() is stripped from value?

Third and the last problem is about built-in types. For example Percentage, Length, Rgb. I'm trying to create cleaned sheet from CSSStyleSheet, but i'm unable to check if attribute value is type of Length or other. When I import those classes from codetalker, 'isinstance' always return False and i need to do some hasattr checks to discover value's type. Is there any other way to do that?

It would be great if css could work in both ways (parse and print).