ampproject / ampproject/worker-dom
querySelector() fails silently for complex selectors
- Dominant language
- TypeScript
- Stars
- 3.3k
- Forks
- 154
- PR merge metrics
- No merged PRs in 30d
Description
`querySelector()` works nicely for simple selectors, as defined [in the code](https://github.com/ampproject/worker-dom/blob/381328155807f6b5dd3049fe80f4f4fe89a30754/src/worker-thread/dom/ParentNode.ts#L101). For more complex selectors, though, it simply fails silently, like this:
```html
Some text
const p = document.querySelector('p.wow');
p.innerHTML = 'different text';
```
I believe this could be remedied by grepping for more complex selectors and adding a warning.
Contributor guide
Research direction
Start in src/worker-thread/dom/ParentNode.ts around the querySelector() implementation linked in the issue. Reproduce the provided p.wow example and inspect how complex selectors are handled. Done means unsupported complex selectors no longer fail silently and instead produce the requested warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100