Closed ThePlenkov closed 3 weeks ago
wouldn't this be OK?
import { parseHTML } from 'linkedom';
const { window, document } = parseHTML('...');
you'll have a clean document with doctype, head, and body in there you can then enrich as you like.
that's a point - i don'\t have anything to parse - I'd like to build DOM document myself instead.
look closer:
parseHTML('...');
the '...'
is not there as placeholder, it is the way to create an empty document where you then need to add anything you like in its head or body.
On the other hand, you can import Document
and construct it https://github.com/WebReflection/linkedom/blob/main/esm/interface/document.js#L63 as long as you specify its mime type in doing so, the rest is for you to handle.
Valid mimes in here: https://github.com/WebReflection/linkedom/blob/main/esm/shared/mime.js
I'd like to render Dom manually with the own logic using this library.
For that purpose I'd like to do something like:
Do you think is feasible to achieve? Thanks!
Here is the spec: https://developer.mozilla.org/en-US/docs/Web/API/Document/Document