I was diagnosing some incorrect HTML in our application using Lift,
and I found a strange behavior of head merging (I assume) when you
emit a <head> tag into a <head> tag from the snippet. The code speaks
better than I do about this:
...
object Dialog extends DispatchSnippet {
val standardDialogOptions: JsObj = JsObj(
"autoOpen" -> false,
"bgiframe" -> true,
"modal" -> true,
"resizable" -> false
)
val dispatch: DispatchIt = {
case "head" => renderHead
case "render" => render
}
def renderHead(ns: NodeSeq): NodeSeq =
<head>{ Script { JsCrVar("pxStandardDialogOptions",
Dialog.standardDialogOptions) } }</head>
...
}
LiftRules.snippetDispatch.append {
...
case "Dialog" => Dialog
...
}
<lift:surround with="default" at="content">
<head>
<title>Email Editor</title>
<lift:Dialog.head />
</head>
</lift:surround>
I agree I'm doing the wrong thing here -- the <lift:Dialog.head /> tag
rightly should be outside of the head block, or the snippet should not
emit <head>. However, the resulting behavior is funny (certainly more
funny than I'd expect):
<html xmlns:lift="http://liftweb.net/" xmlns="http://www.w3.org/1999/xhtml
">
<head>
...
<title>Email Editor</title>
<script type="text/javascript">
// <![CDATA[
var pxStandardDialogOptions = {"autoOpen": false, "bgiframe": true,
"modal": true, "resizable": false};
// ]]>
</script>
<head><script type="text/javascript">
// <![CDATA[
var pxStandardDialogOptions = {"autoOpen": false, "bgiframe": true,
"modal": true, "resizable": false};
// ]]>
</script></head>
</head>
...
</html>
Ideally I'd like this to "just work" so that it doesn't matter
precisely where the snippet is called, though it would be some special
magic just to work around an erroneous case. But, the behavior that
does happen seems odd, duplicating the markup inside the <head>?
Should I file a bug? Just smile and nod?
-Ross
--
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en.