invalid parsed selector, question about url() and built-in types
还没有人认领这个 Issue。
- 主要语言
- 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).
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先使用 CSS parser 和 CSSStyleSheet 重现这三个示例,然后检查 selector、url() 值以及 codetalker 对内置类型的处理。将解析后的输出与原始 CSS 进行比较,并将“完成”定义为保留 selector 和 url() 值,同时提供可靠的类型检查;为每种情况添加回归覆盖。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- tooling
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 20/100