!!! 5 | |
//if lt IE 7 | |
html(class="no-js ie6 oldie", lang="en") | |
//if IE 7 | |
html(class="no-js ie7 oldie", lang="en") | |
//if IE 8 | |
html(class="no-js ie8 oldie", lang="en") | |
// [if gt IE 8] <! | |
html(class="no-js", lang="en") | |
// <![endif] | |
head | |
title= title | |
body!= body |
This comment has been minimized.
This comment has been minimized.
Thanks for sharing this, however, this doesn't seem to work because the html tags within the conditional comments are empty and they will close before the header opens. This code validates, of course, because the code inside the comments will be ignored but effectively, in IE the page it's outside the element This is the generated code:
|
This comment has been minimized.
This comment has been minimized.
hey gui, check out https://github.com/robrighter/node-boilerplate/blob/master/templates/views/layout.jade i use that one and it works fine (although I update mine to current h5b - eg lt-ie8 class instead of ie8 class |
This comment has been minimized.
This comment has been minimized.
Hi David, I've C+P the code on that link into a jade template and this is how it renders:
As you can see there's a |
This comment has been minimized.
This comment has been minimized.
I'm not at a computer totest this, but jade must have changed something in its engine since this was/is working fine for me with no extra closing HTML tags. I'll test it out. |
This comment has been minimized.
This comment has been minimized.
This is the exact Jade I use:
//- # Layout
//- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/
<!--[if HTML5]><![endif]-->
!!! 5
//- H5BP implementation inspired by https://gist.github.com/888338/.
//if lt IE 7
<html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en">
//if IE 7
<html class="no-js lt-ie9 lt-ie8" lang="en">
//if IE 8
<html class="no-js lt-ie9" lang="en">
//[if gt IE 8]><!
html(class='no-js', lang='en')
//<![endif]
And I can confirm it definately doesn't generate an extra closing </html>
tag,
so if that doesn't work for you Kelly is probably right
|
This comment has been minimized.
This comment has been minimized.
HI David, that explains. The Jade on your last comment is more or less how I'm doing it at the moment and it does work but this is not the same code as the original one because all you are doing is writing literal HTML for the opening tag. The original code, on the other hand, instructs Jade to create a |
This comment has been minimized.
This comment has been minimized.
@guioconnor: The one from David is correct. By using literal tags it stops Jade from attempting to auto close the tag, like yours is doing. |
This comment has been minimized.
This comment has been minimized.
Here's another take using comments and literals: https://gist.github.com/3879867 |
This comment has been minimized.
This comment has been minimized.
I recommend the following since jade renders a closing html tag
|
This comment has been minimized.
This comment has been minimized.
Nice improvement @jwerre -- have you attempted to remove the unwanted white space between these at all? I'm fairly confident there isn't really a way to do it, but if there is I'd love to find out as I'm completely OCD about stuff like that :) |
This comment has been minimized.
This comment has been minimized.
please do note that this behaviour has been ripped out of jade now... Now, you have to just use this: <!--[if lt IE 8]>
link(rel='stylesheet', href='style-ie8.css')
<![endif]--> |
This comment has been minimized.
This comment has been minimized.
Can you please define 'now'? Thanks. |
This comment has been minimized.
thanks so much for making this available, I couldn't seem to get the indenting right or something and all the html tags weren't wrapping the content, they we're just immediately closing. Anyway, cheers.