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
html5shiv requires explicit "<body>" tag #100
Comments
It is a big deal IMO, this just cost me quite some time to find out why we were getting a blank screen on IE8. This works:
This crashes with an obscure jQuery error:
|
I'm not fully convinced, that we should document every edge case. html5shiv simply adds the capability of using the new elements, it does not implement the HTML -> DOM parsing algorythm. This should be clear. The browser including IE8 simply auto inserts the body on the first element, which has to be in the body. There are only some bugs in IE, that unknown elements (like HTML5 ones), div and form elements do not trigger this insert. This means the following code works again:
Or even a textnode is good enough for this:
This said: Especially, if you work with a CMS and you are using multiple different templates, it is always bad to omit html, head and body. Because you do not have full control, where it is inserted (although modern browsers are doing it consistent way.) |
According to the spec, the
<body>
tag is optional. However it seems that it is necessary to explicitly include it for html5shiv to work.For example this works:
But if you take out the
<body>
tag then the page will be blank.Not a big deal, but maybe could be mentioned in the "Known issues" section.
The text was updated successfully, but these errors were encountered: