WebReflection / WebReflection/linkedom
Exceptions thrown when setting Element's innerHTML or innerText with non-string value
Open
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 2.1k
- Forks
- 104
- PR merge metrics
- No merged PRs in 30d
Description
Reproduciable example:
import { parseHTML } from 'linkedom';
const window = parseHTML('<!DOCTYPE html><html><head></head><body></body></html>');
// These are OK:
// window.document.body.innerHTML = '1';
// window.document.body.innerText = '1';
// These are not:
window.document.body.innerHTML = 1;
window.document.body.innerText = 1;
The behavior tested on the browser seems to be consistent with
set innerHTML(value) {
internalSetInnerHTMLWithString(this, value === null ? '' : String(value));
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue's parseHTML example and compare assignments of numeric values with browser behavior. The issue does not mention a source file or test; done means setting innerHTML and innerText with non-string values no longer throws and follows the shown string-coercion behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100