ampproject / ampproject/worker-dom
Improve support for complex selectors in `document.querySelector[All]()`
- Dominant language
- TypeScript
- Stars
- 3.3k
- Forks
- 154
- PR merge metrics
- No merged PRs in 30d
Description
Following up on https://github.com/ampproject/worker-dom/issues/111, I had legitimate use cases for the following unsupported selectors in a [recent PR](https://github.com/ampproject/amphtml/pull/26371):
* `.class1.class2` and `selector1, selector2` [workaround](https://github.com/danielrozenberg/amphtml/blob/bf947479bc680415f2a76f1c932a88b584735191/contributing/release-schedule-visual.amp.html#L420-L421)
* `.class[data=value]` (and `.class[data1=value1][data2=value2]` [workaround](https://github.com/danielrozenberg/amphtml/blob/bf947479bc680415f2a76f1c932a88b584735191/contributing/release-schedule-visual.amp.html#L431-L435)
(I also initially tried to use `.class element` but changes to code removed the need for it)
None of these are un-workaround-able of course :)
Contributor guide
Research direction
Start by tracing the document.querySelector and querySelectorAll entry points and read the linked issue 111 for prior context. Use the listed selector examples as the scope: support combined classes, comma-separated selectors, and class-plus-attribute selectors, including multiple attributes. Done means these selectors work without the documented workarounds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100