Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yuyz0112/content-finder
DOM selector generator with content awareness
https://github.com/yuyz0112/content-finder
Last synced: about 1 month ago
JSON representation
DOM selector generator with content awareness
- Host: GitHub
- URL: https://github.com/yuyz0112/content-finder
- Owner: Yuyz0112
- Created: 2019-10-19T07:04:01.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T22:59:30.000Z (almost 2 years ago)
- Last Synced: 2024-05-01T19:14:00.493Z (7 months ago)
- Language: TypeScript
- Size: 239 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# content-finder
Fork from https://github.com/antonmedv/finder
## What's the difference
### 1. return the path stack instead of the selector string
```html
Hello World
World
```If we get the first `` element from this HTML with `finder`, it will return `p > span`.
With `content-finder` we will have:
```js
[{ name: "p", content: null }, { name: "span", content: null }];
```### 2. use content as part of the selector
```html
foo
bar
```If we get the first `
` element from this HTML with `finder`, it will return `p:nth-child(1)`.
With `content-finder` we wil have:
```js
[{ name: "p", content: "foo" }];
```This means there is only one `
` element has the content `foo`. Comparing to the nth-child selector, the selector with content is more semantic.
Although content selector is not part of the standard CSS selector, there are some libraries/frameworks support query by content (e.g., jQuery, Cypress).