-
Notifications
You must be signed in to change notification settings - Fork 34
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
Add support for parsing <!DOCTYPE html>
#71
Conversation
<!DOCTYPE html>
<!DOCTYPE html>
<!DOCTYPE html>
<!DOCTYPE html>
can we make this non-breaking by calling those methods only if they exist? |
for the benefit of historical info: the original theory of this library is that it was basically for body templates, and therefore I didn't implement the states for doctype/script, etc. This was in the interest of keeping the library reasonably small: the states I left out are something like half of all tokenizer states! I have no problem with working on adding in those states now, especially since the main use-case for this library ends up being preprocessing, which happens in contexts where size doesn't matter so much. |
Agreed. We need a complete parser and serializer. |
The [spec](https://html.spec.whatwg.org/multipage/syntax.html#the-doctype) says this about `<!DOCTYPE`: > DOCTYPEs are required for legacy reasons. When omitted, browsers tend to > use a different rendering mode that is incompatible with some > specifications. Including the DOCTYPE in a document ensures that the > browser makes a best-effort attempt at following the relevant > specifications.
This allows the change to be non-breaking.
Apologies for not leaving a comment above when I reopened / merged this. I would like to move this forward (and begin expanding the scope of this library slowly) because I believe that the path forward in SSR is to have the template own the full HTML (instead of having the template rendered output spliced into an HTML content string). Doing this fixes some things that are quite annoying today (e.g. rendering custom I will try to investigate migrating |
@rwjblue We definitely need to talk about this before you make any further steps in that direction, but I'm not intrinsically opposed to the approach you have in mind. |
@wycats yep, I was mostly just going to see if it were possible (seems like it should be) |
@rwjblue My main concerns would be:
|
The spec says this about
<!DOCTYPE
:This fixes an issue where we would end up in an incorrect state when the
<!DOCTYPE
declaration was found (e.g. ember-template-lint/ember-template-lint#719).Addresses ember-template-lint/ember-template-lint#719
Addresses stefanpenner/find-scripts-srcs-in-document#1
The specific breaking changes here are that the delegate now must have the following new methods:
Closes #28.