Module: Speedo::LayoutHelper

Defined in:
lib/speedo/layout_helper.rb

Instance Method Summary collapse

Instance Method Details

#cc_html(options = {}, &blk) ⇒ Object

Implements the Paul Irish IE conditional comments HTML tag–in HAML. paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/speedo/layout_helper.rb', line 6

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")
end