css icon indicating copy to clipboard operation
css copied to clipboard

invalid parsed selector, question about url() and built-in types

Open tkloc opened this issue 13 years ago • 1 comments

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).

tkloc avatar Feb 06 '12 11:02 tkloc

I'll look into it. I just got back last week from serving a mission in Germany for two years, so I'm getting back up to speed on a lot of my projects :) thanks for bearing with me.

jaredly avatar Jul 27 '12 02:07 jaredly