Exceptions thrown when setting Element's innerHTML or innerText with non-string value
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));
}
can you please provide a single real-world use case for this?
can you please provide a single real-world use case for this?
https://github.com/mrdoob/three.js/blob/4ec743df6500ae6fc93f3a28ed02a9912e01f443/examples/webgpu_textures_anisotropy.html#L148
I discovered this problem when I was trying to use linkedom to simulate the DOM environment to run Three.js on Deno.
PR welcomed, it's on the setting path so it shouldn't affect performance much, also because innerHTML is really ancient accessor, hopefully not so common to use ... but this feels like a no-brainer to fix, it gotta end up being a string anyway.