Skip to content

fix: support CSS selectors in targeted extract #797

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tinkerer-shubh
Copy link

why

fixes: #653

what changed

Added CSS selector support to targeted extract by detecting selector type and routing to the appropriate DOM API (document.querySelector() for CSS, document.evaluate()for XPath).

test plan

Copy link

changeset-bot bot commented Jun 5, 2025

⚠️ No Changeset found

Latest commit: cc2818d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

Added support for CSS selector queries in targeted extract operations, while maintaining backward compatibility with XPath selectors.

  • Modified lib/handlers/extractHandler.ts to handle both CSS and XPath selectors in targeted extract operations
  • Added resolveObjectIdForSelector in lib/a11y/utils.ts to intelligently route selectors to appropriate DOM APIs
  • Improved selector handling to support document.querySelector() for CSS and document.evaluate() for XPath queries
  • Maintained backward compatibility with existing XPath selectors (prefixed with 'xpath=')

💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!

2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

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.

Targeted extract should work with a non-xpath CSS query
1 participant