Closed krulod closed 7 months ago
all constructors need to know which document they belong to and the document
is the first argument, meaning you can do something like:
import { Text as RawText } from '...';
const Text = RawText.bind(null, currentDocument);
new Text('content');
and that's pretty much it.
I could infer automatically the document if only one has been created though, but to date these use case are pretty rare as many constructors break out of the box with standard DOM so that "legacy methods" are actually just the start way to create elements while using constructors is a slippery slope for Web interop.
I hope this answers or solve your issue.
This module does not support Node constructors like
new Text
currently, enforcing the usage of older APIs likedocument.createTextNode
.I tried to fix it myself, but gave up because I couldn't figure out how to provide objects with
ownerDocument
.