Binding in 2.6

36 views
Skip to first unread message

Dan Gravell

unread,
Oct 26, 2016, 9:09:53 AM10/26/16
to Lift
Did something change in 2.6 regarding template binding?

I used to have something like:

top-nav.html:

<lift:surround with="default" at="content">
<body class="top-navigation">

<div data-lift="embed?what=cookie-optout" />
        ...
<lift:bind name="content" />
        ...
</body>
</lift:surround>

default.html:

<head>
...
</head>

<lift:bind name="content" />
</html>

top-nav.html is used by child pages, and their content is added at the "<lift:bind name="content" />" in top-nav.

This worked in 2.5. In 2.6, the embed?what=cookie-optout is rendered twice, and nothing else.

That second "<lift:bind name="content" />" uses the same id for the content - is this a problem?

This still uses legacy lift tags - were these removed?

I get the following errors in the log:

WARN  Unused binding values for <lift:bind>: content

Dan

Antonio Salazar Cardozo

unread,
Oct 26, 2016, 11:53:23 AM10/26/16
to Lift
They were not removed, but behavior changed due to switching to HTML5 parsing
by default, IIRC. If that's the issue, the easiest way to transition right now would be to go:

  LiftRules.htmlProperties.default.set((r: Req) => 
        new XHtmlInHtml5OutProperties(r.userAgent)) 

This would read files as XHTML and spit them out as HTML5, which would let the
current lift tags continue to work correctly.

Let us know if that helps!
Thanks,
Antonio

Dan Gravell

unread,
Oct 27, 2016, 10:46:14 AM10/27/16
to Lift
Yes, that worked, thanks.

Does this also mean I don't need the nu.validator lib?

Finally, what should I be doing really - all designer friendly templating? Is it purely the <lift> tags causing it?

Dan

Antonio Salazar Cardozo

unread,
Nov 1, 2016, 8:10:31 AM11/1/16
to Lift
Yes, I would aim for designer-friendly templating for sure. Lift 3 removes support for
the old style of binding altogether, though templating based on lift: tags should still
work as long as you use the correct parser (per the configuration above), IIRC. So
I'd say do what suits you.

You do still need the Nu stuff as I believe it's used during HTML5 serialization---and
Lift generally serializes as HTML5 even when parsing as XHTML (thus `XHtmlInHtml5OutProperties`).
Thanks,
Antonio
Reply all
Reply to author
Forward
0 new messages