ampproject / ampproject/worker-dom
Issues with changing innerHTML
Open
- Dominant language
- TypeScript
- Stars
- 3.3k
- Forks
- 154
- PR merge metrics
- No merged PRs in 30d
Description
```html
Press me
document.querySelector('#btn').addEventListener('click', () => {
document.body.innerHTML += '<p>Hello</p>';
});
```
Two things happen when the button is pressed:
1. The button gets removed.
2. `` gets added as the first element of the body.
Contributor guide
Research direction
Reproduce the provided amp-script example and trace the document.body.innerHTML setter and DOM update path in worker-dom. Check why appending a paragraph removes the button and inserts an empty q element; done means the button remains and only the requested paragraph is added.
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
- 45/100