Skip to content

Instantly share code, notes, and snippets.

@j9t j9t/test.html
Last active Sep 18, 2019

Embed
What would you like to do?
<!DOCTYPE html>
<title>␣</title>
@thierryk

This comment has been minimized.

Copy link

thierryk commented Aug 16, 2014

You are missing <!-- TADA! -->

@j9t

This comment has been minimized.

Copy link
Owner Author

j9t commented Aug 17, 2014

Oops. :)

@wooorm

This comment has been minimized.

Copy link

wooorm commented Sep 11, 2019

@j9t There is a shorter version (if we’re allowing parse errors, which user agents do)! You don’t need the space between DOCTYPE and html! https://html.spec.whatwg.org/multipage/parsing.html#doctype-state

<!DOCTYPEhtml>
<title>␣</title>
@j9t

This comment has been minimized.

Copy link
Owner Author

j9t commented Sep 17, 2019

@wooorm, interesting! Yet I read the spec that there must be either of U+0009, U+000A, U+000C, or U+0020, and not no character to proceed. Which would be backed by validation of the snippet. Although a version without a space would be shorter (and likewise one without a line break between DOCTYPE and title, I might for once vote for leaving those characters :)

@wooorm

This comment has been minimized.

Copy link

wooorm commented Sep 18, 2019

Right, that is reasonable! 👍 To clarify: yes, it is a parse error, which conformance checkers like the validator should report, but parse errors are well defined in the HTML spec (e.g., <div id=a id=b> is a parse error, but works the same in browsers following the spec)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.