Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support <!DOCTYPE html> #9

Open
jimafisk opened this issue Nov 29, 2021 · 0 comments
Open

Support <!DOCTYPE html> #9

jimafisk opened this issue Nov 29, 2021 · 0 comments

Comments

@jimafisk
Copy link
Member

The <!DOCTYPE> prototype is DocumentTypePrototype and a regular element is ElementPrototype.

For example a <div> is ElementPrototype > HTMLElementPrototype > HTMLDivElementPrototype.

So if you're hydrating at the top level of the document, you need to account for this since you can't create <!DOCTYPE html> like a regular element.

Creating regular html element in JS
document.createElement("div");
Creating !DOCTYPE in JS
document.implementation.createDocumentType('html', '-//W3C//DTD XHTML 1.0 Transitional//EN', 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtdd');

There's a discussion with more details regarding the challenges of hydrating <!DOCTYPE> in Svelte here: plentico/plenti#91

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant