[feature-request] `:not()` to support generic selectors (not only "simple" ones)
维护者通常 1 天内回复
评估
调研方向
使用 cssselect.parse('a:not(p>a)') 重现该失败。从回溯中出现的 cssselect/parser.py 中的 parse、parse_selector_group 和 parse_simple_selector 开始。完成的标准是,所请求的通用选择器形式能够被 :not() 接受,而不会出现所示的语法错误。
由索引模型根据 Issue 内容生成。
描述
The document (version 0.9.1) says:
:not()accepts a sequence of simple selectors, not just single simple selector. For example,:not(a.important[rel])is allowed, even though the negation contains 3 simple selectors.
May I ask what is a simple selector? Can :not() support something like :not(a>b)?
>>> import cssselect
>>> cssselect.parse('a:not(p>a)')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.4/site-packages/cssselect/parser.py", line 355, in parse
return list(parse_selector_group(stream))
File "/usr/lib/python3.4/site-packages/cssselect/parser.py", line 370, in parse_selector_group
yield Selector(*parse_selector(stream))
File "/usr/lib/python3.4/site-packages/cssselect/parser.py", line 378, in parse_selector
result, pseudo_element = parse_simple_selector(stream)
File "/usr/lib/python3.4/site-packages/cssselect/parser.py", line 471, in parse_simple_selector
raise SelectorSyntaxError("Expected ')', got %s" % (next,))
cssselect.parser.SelectorSyntaxError: Expected ')', got <DELIM '>' at 7>
- 主要语言
- Python
- 星标
- 311
- 派生
- 74
- 平均合并
- 22 小时 53 分钟
- 30 天内合并 PR
- 21
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
scrapy/cssselect 的其他 Issue
-
Add comprehensive developer docs可能已有人在做 @AdrianAtZyte 于 76 天前认领。 未关闭documentation enhancement
难度 4/5 3-5 天 新手友好度 48/100
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 42/100
维护者通常 1 天内回复
-
The parsing of :where and :is is not spec compliant可能已有人在做 @AdrianAtZyte 于 90 天前认领。 未关闭CSS Selectors Level 4 enhancement
难度 4/5 3-5 天 新手友好度 35/100
scrapy/cssselect#135 · 1 个 reaction ·
维护者通常 1 天内回复
-
Support :nth-child(An+B of S)可能已有人在做 @annbgn 于 1941 天前认领。 未关闭CSS Selectors Level 4
难度 4/5 3-5 天 新手友好度 35/100
维护者通常 1 天内回复
相似的 Issue
-
follow-up needs-triage S3: minor
难度 2/5 1-3 小时 新手友好度 72/100
manaflow-ai/cmux#36856 · 1 条评论 ·
维护者通常 1 天内回复
-
documentation good first issue help wanted
难度 1/5 1-3 小时 新手友好度 90/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 73/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
-
Shell framework build fails at "copy the shader libraries": the iOS shader libraries are now one file b-<chain>.img可能已有人在做 @xiaofeng-han 今天认领。 未关闭build ios
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复