We use a snippet that stands in for the comment tags themselves:
object Util {
def snippetHandlers : SnippetPF = {
case List("ie-conditional-comment") => ieConditionalComment _
}
def ieConditionalComment(xhtml:NodeSeq) = {
val ieVersion =
(for (version <- S.attr("version")) yield version) openOr "IE"
Unparsed("<!--[if " + ieVersion + "]>") ++ xhtml ++ Unparsed("<![endif]-->")
}
}
(Util.snippetHandlers gets added to LiftRules.snippets.)
Then you can do:
<lift:ie-conditional-comment>
<stuff>
</lift:ie-conditional-comment>
You can also do:
<lift:ie-conditional-comment version="IE9">
...
</lift:ie-conditional-comment>
If you use lift:with-resource-id inside (which we do), you'll also need to add eager_eval="true" to the end.
Thanks,
Antonio