Unable to Correctly Parse `:has()` Pseudo-Classes with More than a Singular Child
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 68/100
Hướng nghiên cứu
Start at the GenericTranslator().css_to_xpath entry point and reproduce the three :has() examples from the issue. Trace how :has() arguments are parsed, especially attribute selectors and descendant selectors. Done means these arguments translate successfully while the existing singular-tag and combinator cases continue to work.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Issue
When attempting to parse a CSS selector using a :has pseudo-class, it works but only if a singular tag name is provided.
For example, if selecting for a child with attributes:
>>> from cssselect import GenericTranslator
>>> GenericTranslator().css_to_xpath('h4.my-class:has(a[href^="/rel"])')
*** cssselect.parser.SelectorSyntaxError: Expected an argument, got <DELIM '[' at 17>
Likewise, if attempting to select for a tag with a descendant tag, we get:
>>> GenericTranslator().css_to_xpath('h4.my-class:has(div a')
*** cssselect.parser.SelectorSyntaxError: Expected an argument, got <IDENT 'a' at 20>
However, selecting for a singular tag name works:
>>> GenericTranslator().css_to_xpath('h4.my-class:has(a)')
"descendant-or-self::h4[(@class and contains(concat(' ', normalize-space(@class), ' '), ' my-class ')) and (descendant::a)]"
Diagnosing it further, this also does not affect combinators inside the :has(...):
>>> GenericTranslator().css_to_xpath('h4.my-class:has(> a)')
"descendant-or-self::h4[(@class and contains(concat(' ', normalize-space(@class), ' '), ' my-class ')) and (./a)]"
Information
Running cssselect version 1.5.0.
- Ngôn ngữ chính
- Python
- Star
- 312
- Fork
- 72
- Merge trung bình
- 2 ngày 24 phút
- Pull request đã merge (30 ngày)
- 11
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của scrapy/cssselect
-
Add comprehensive developer docsCó thể đã có người làm @AdrianAtZyte đã nhận 57 ngày trước. Đang mởdocumentation enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 42/100
Maintainer thường phản hồi trong vòng 1 ngày
-
The parsing of :where and :is is not spec compliantCó thể đã có người làm @AdrianAtZyte đã nhận 71 ngày trước. Đang mởCSS Selectors Level 4 enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
scrapy/cssselect#135 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Support :nth-child(An+B of S)Có thể đã có người làm @annbgn đã nhận 1921 ngày trước. Đang mởCSS Selectors Level 4
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
scrapy/cssselect#76 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[feature-request] `:not()` to support generic selectors (not only "simple" ones)Có thể đã có người làm @AdrianAtZyte đã nhận 71 ngày trước. Đang mởCSS Selectors Level 4
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
scrapy/cssselect#51 · 3 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của scrapy/cssselect
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Graphify-Labs/graphify#4524 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
topoteretes/cognee#5982 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Patches of derivations with `__structuredAttrs` are ignoredCó thể đã có người làm @KiaraGrouwstra đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 81/100
nix-community/vulnix#184 ·
-
New InternshipĐang mởnew_internship
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
aws-samples/sample-per-model-bedrock#295 ·
Maintainer thường phản hồi trong vòng 1 ngày