0

I am doing a rails app and I found bit issue following what @matt suggested in his answer, I am finding below issues:

HAML

!!!
= surround '<!--[if !IE]> -->'.html_safe, '<!-- <![endif]-->'.html_safe do
  %html.no-js{:lang => 'en'}
  %head
  %body

Here is how the browser render the HTML (without ending tag at very end and adds it at declaring line itself)

<!DOCTYPE html>
<!--[if !IE]> --><html class='no-js' lang='en'></html>
<head>..</head>
<body>..</body>

So, here is the code that's working fine for me, but is there a way to make above code work ?

!!!
:plain
  <!--[if !IE]><!-->
%html.no-js{:lang => 'en'}
  / <![endif]
Community
  • 1
  • 1
Syed
  • 15,657
  • 13
  • 120
  • 154
  • I think you’re looking for something like this question: http://stackoverflow.com/questions/12868977/conditional-html-tag-in-haml, which isn’t quite the same as the one you linked to. – matt Nov 03 '14 at 16:33

1 Answers1

0

Not sure if it's causing the problem, but head and body should be inside the html tag.

!!!
= surround '<!--[if !IE]> -->'.html_safe, '<!-- <![endif]-->'.html_safe do
  %html.no-js{:lang => 'en'}
    %head
    %body

Could be confusing the surround method by having multiple tags appended instead of nested... Worth a try!

Nick Veys
  • 23,458
  • 4
  • 47
  • 64
  • thanks for trying to figure out solution, I tried with you said but it didn't worked well, the output was this: ' .. .. ' – Syed Nov 03 '14 at 15:57
  • Oh I'm sorry, I misinterpreted your question. I don't know of a way to get exactly what you're looking for. Best of luck! – Nick Veys Nov 03 '14 at 16:02