Open jimafisk opened 2 years ago
The <!DOCTYPE> prototype is DocumentTypePrototype and a regular element is ElementPrototype.
<!DOCTYPE>
DocumentTypePrototype
ElementPrototype
For example a <div> is ElementPrototype > HTMLElementPrototype > HTMLDivElementPrototype.
<div>
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.
document
<!DOCTYPE html>
There's a discussion with more details regarding the challenges of hydrating <!DOCTYPE> in Svelte here: https://github.com/plentico/plenti/issues/91
The
<!DOCTYPE>
prototype isDocumentTypePrototype
and a regular element isElementPrototype
.For example a
<div>
isElementPrototype
>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
```js document.createElement("div"); ```Creating !DOCTYPE in JS
```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: https://github.com/plentico/plenti/issues/91