Yes, 7.12 vs. 7.13. Apparently the prefix is not supposed to be lift like I thought but the prefix of the node it belongs to. But I still have the question. It would seem more logical that just like nodes, attributes that are prefixed are not html, and html attributes should not be prefixed. What was the reasoning behind this?
------------------------------------- marius d.<[email protected]> wrote: What listing from the book are you referring to ? 7.13 ? <lift:Ledger.balance> <ledger:time ledger:id="myId" class="bold"/> </lift:Ledger.balance> and the code: class Ledger { def balance (content : NodeSeq ) : NodeSeq = { bind ("ledger", content, "time" -> <span>{(new java.util.Date).toString}</span>) } } would output <span id=”myId”>Sat Mar 28 16:43:48 EET 2009</span>. so ledger:id was preserved in the output node. So class attribute is not preserved. Is that you are referring to ? Well ledger:time node is just an xml node meaningless without the snippet's magic. You can access the unprefixed attributes passed to this node with BindHelpers.attrs such as bind ("ledger", content, "time" -> {node:NodeSeq => <span class={BindHelpers.attr("class")}> {(new java.util.Date).toString}</span>)} } to your questions ... why we preserve the attributes having the same prefix with the node and not the default ones is simply a design choice (the way I see it) that by the common prefix there is a hint that this attribute should stay in the output node. It is not a rock solid argumentation but kinda makes sense. Unprefixed attributes here may be attributes that have nothing to do with output node, but rather with processing logic. To change this behavior a consensus should be made. Personally I'm not truly convinced it should be but who knows ... Br's, Marius On Aug 14, 7:06 am, Naftoli Gugenheim <[email protected]> wrote: > What I would like to do: > <label for="name">Name</label> <person:name I'd="name" size="10" > class="special" style="vertical-align: top" maxlength="5" tabindex="1" /> > Okay, just a little contrived... > My understanding is you can do this by prefixing the attribute with "lift:"; > otherwise it will not be output but is available to the snippet code, i.e., > without the prefix you are making an attribute available to the snippet but > that's it. > I'm getting this from Exploring Lift page 115. > > ------------------------------------- > > David Pollak<[email protected]> wrote: > > On Thu, Aug 13, 2009 at 7:24 PM, Naftoli Gugenheim > <[email protected]>wrote: > > > > > Why was the decision made, if I understand correctly, that normal > > attributes are not preserved in a bound node, and are are only available for > > the snippet's usage, and if you want the attribute to be "sticky" you have > > to prefix it with "lift:"? Wouldn't it be better the other way? > > I don't understand your question. Are you talking about Helpers.bind() or > are you talking about snippet dispatching? > > Can you please provide an example of what happens now and what you would > expect to happen? > > > > > One of lift's design goals is to help keep the static html in the view and > > the logic in the code, and to provide a templating system that doesn't > > interfere with visual web designers. It seems to me that it would further > > this goal if html attributes could be properly specified in the view html. > > -- > Lift, the simply functional web frameworkhttp://liftweb.net > Beginning Scalahttp://www.apress.com/book/view/1430219890 > Follow me:http://twitter.com/dpp > Git some:http://github.com/dpp --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
