Skip to content

Get unique and simpler selectors #15

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

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

estrada9166
Copy link
Member

@estrada9166 estrada9166 commented Jun 3, 2025

Closes #14

…functionality

- Changed Babel preset from "latest" to "@babel/preset-env" for better compatibility.
- Added new utility function `getDataAttributes` to extract data-* attributes from elements.
- Enhanced selector logic to prioritize data-* attributes in the unique selector generation.
- Introduced comprehensive tests for data-* attribute handling and selector prioritization.
…eneration

- Introduced a new utility function `getPotentialUniqueSelector` to recursively find a unique selector for a given element, considering various selector types and attributes to ignore.
- Updated the main `unique` function to utilize the new selector generation logic.
- Adjusted tests to reflect changes in expected unique selectors for various elements.
@CLAassistant
Copy link

CLAassistant commented Jun 3, 2025

CLA assistant check
All committers have signed the CLA.

…nction

- Added caching mechanisms for various selector functions (getAttributeSelector, getAttributes, getClasses, getDataAttributes, getID, getName, getNthChild, getTag) to improve performance.
- Introduced a new function `getPotentialUniqueSelectors` to recursively find unique selectors for elements, considering multiple attributes and caching for efficiency.
- Updated existing functions to utilize caching and handle filters more effectively.
- Adjusted tests to validate the new selector generation logic and caching behavior.
@jennifer-shehane
Copy link
Member

@estrada9166 Can you sign the CLA?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants