Created
June 20, 2013 04:58
-
-
Save jcypret/5820400 to your computer and use it in GitHub Desktop.
IE Conditional Comments HAML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Implements the Paul Irish IE conditional comments HTML tag--in HAML. | |
# http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ | |
# http://ricostacruz.com/2010/haml_and_ie_compatibility.html | |
def cc_html(options={}, &blk) | |
attrs = options.map { |(k, v)| " #{h k}='#{h v}'" }.join('') | |
[ "<!--[if lt IE 7 ]> <html#{attrs} class='ie6'> <![endif]-->", | |
"<!--[if IE 7 ]> <html#{attrs} class='ie7'> <![endif]-->", | |
"<!--[if IE 8 ]> <html#{attrs} class='ie8'> <![endif]-->", | |
"<!--[if IE 9 ]> <html#{attrs} class='ie9'> <![endif]-->", | |
"<!--[if (gt IE 9)|!(IE)]><!--> <html#{attrs}> <!--<![endif]-->", | |
capture_haml(&blk).strip, | |
"</html>" | |
].join("\n").html_safe | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment