invalid parsed selector, question about url() and built-in types
- Vorherrschende Sprache
- Python
- Sterne
- 17
- Forks
- 2
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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).
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Beginne damit, die drei Beispiele mit dem CSS parser und CSSStyleSheet zu reproduzieren, und untersuche anschließend den selector, den url()-Wert und die Behandlung integrierter Typen durch codetalker. Vergleiche die geparste Ausgabe mit dem ursprünglichen CSS und definiere „fertig“ so, dass selector und url()-Werte erhalten bleiben und zuverlässige Typprüfungen bereitgestellt werden; füge für jeden Fall eine Regressionstestabdeckung hinzu.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 20/100