Skip to content

feat(parser): wire ::text and ::attr() pseudo-elements into css_get/css_getall - #96

Merged
claude[bot] merged 2 commits into
masterfrom
claude/css-pseudo-1sub94
Aug 5, 2026
Merged

feat(parser): wire ::text and ::attr() pseudo-elements into css_get/css_getall#96
claude[bot] merged 2 commits into
masterfrom
claude/css-pseudo-1sub94

Conversation

@claude

@claude claude Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Batch 6a: translator.rs (parse_css_query) existed but was dead code, while the README advertised ::text/::attr() support (audit finding #7 — the alternative was deleting the module).

New Parsel-style methods on Selector and SpiderResponse:

  • css_getall("li::text") — full recursive text of each match, original word spacing preserved (text nodes joined unstripped, ends trimmed — so a <b>bold</b> word stays a bold word)
  • css_getall("a::attr(href)") — attribute values; elements without the attribute are skipped (Parsel semantics)
  • css_getall("div.card") — outer HTML per match
  • css_get(...) — first value only (Parsel's .get())

5 new tests cover text/attr extraction, attr-missing skipping, first-value, plain-selector outer HTML, and recursive-text word spacing.

https://claude.ai/code/session_01KDFsMaKk764vogjUW3nqpk


Generated by Claude Code

claude added 2 commits August 5, 2026 21:52
…ss_getall

translator.rs (parse_css_query) existed but was dead code, while the
README advertised ::text/::attr() support. New Parsel-style methods on
Selector and SpiderResponse:

- css_getall("li::text") — full recursive text of each match, with
  original word spacing preserved (joined unstripped, ends trimmed)
- css_getall("a::attr(href)") — attribute values; elements without the
  attribute are skipped, matching Parsel
- css_getall("div.card") — outer HTML of each match
- css_get(...) — first value only (Parsel's .get())

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KDFsMaKk764vogjUW3nqpk
…nce docs

Review follow-ups: an element with no text nodes now yields nothing
from ::text queries (Parsel parity, symmetric with the ::attr path), so
css_get returns the first element with actual text instead of Some("").
Doc comments now say Parsel-inspired and spell out the divergences:
one joined string per matched element (not per text node), always
recursive, end-trimmed, script/style text included.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KDFsMaKk764vogjUW3nqpk
@claude
claude Bot merged commit 44921b9 into master Aug 5, 2026
7 checks passed
@github-actions
github-actions Bot deleted the claude/css-pseudo-1sub94 branch August 5, 2026 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant