jaredly / jaredly/css

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

オープン
#3 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
17
フォーク
2
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず、CSS parser と CSSStyleSheet に対して3つの例を再現し、次に selector、url() の値、codetalker の組み込み型の処理を調べます。解析された出力を元の CSS と比較し、selector と url() の値を保持したうえで信頼できる型チェックを公開できれば完了と定義します。各ケースに対するリグレッションカバレッジを追加してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
20/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。