possible bug in Jx

68 views
Skip to first unread message

altmattr

unread,
Oct 2, 2012, 3:38:04 AM10/2/12
to lif...@googlegroups.com
Hi,

I am trying to make the examples from chapter 10 of exploring lift work (http://exploring.liftweb.net/master/index-10.html#toc-Chapter-10) and I consistently get unwanted behaviour from Jx.toJs

The following example shows the behaviour

scala> Jx(<ul>{JsVar("it")}</ul>).toJs
res5: net.liftweb.http.js.JsExp = 
JsExp(function(it) {var df = document.createDocumentFragment();

var vF1140778587153CG5PNF = document.createElement("ul");

df.appendChild(vF1140778587153CG5PNF);

vF1140778587153CG5PNF.appendChild(document.createTextNode("JsExp(it)"));;
return df;})

You can see that the JsVar in the Jx is getting converted to the string "JsVar(it)" instead of to the actual javascript variable.  This is breaking the examples in sections 10.3 and 10.6. A search of the internet tells me both those examples once worked, so I assume something has changed.  Is is a bug or a change in expected behaviour?  Or have I made some mistake?

matt


David Pollak

unread,
Oct 2, 2012, 9:37:46 AM10/2/12
to lif...@googlegroups.com
The whole Jx thing is pretty much dead. It was rarely used and caused some type hierarchy issues (all the JsExp's were subclasses of Node which caused lots of grief).

--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
 
 
 



--
Telegram, Simply Beautiful CMS https://telegr.am
Lift, the simply functional web framework http://liftweb.net


jvr

unread,
Dec 31, 2012, 2:02:40 PM12/31/12
to lif...@googlegroups.com
But for us this is one of the main reasons to use Lift...

That's a very bad message!


Joe

David Pollak

unread,
Dec 31, 2012, 6:49:04 PM12/31/12
to lif...@googlegroups.com
We pulled the Jx feature years ago. Nobody noticed. It's not a bad message... it's a direction that nobody used.

Naftoli Gugenheim

unread,
Jan 1, 2013, 7:40:39 PM1/1/13
to liftweb
There's a whole Javascript DSL, it's just Jx.

jvr

unread,
Jan 8, 2013, 7:19:27 AM1/8/13
to lif...@googlegroups.com
There are people -like me- who just started to learn Lift today.

On the http://www.liftweb.net/ website there are references to Lift Books, i.e. Exploring Lift, by Derek Chen-Becker, Tyler Weir.
(which is almost identical to "The Definitve Guide to Lift")

It took me hours to try out the examples (http://exploring.liftweb.net/master/index-10.html)
because they won't work.

It would be nice to state "Jx is deprecated, don't use it anymore!"

Are there any alternatives ?


Thank you!


Joe

David Pollak

unread,
Jan 8, 2013, 11:06:44 AM1/8/13
to lif...@googlegroups.com
Feel free to write wiki pages about Lift. Feel free to submit pull requests to the Exploring Lift guys correcting their book.

But with any piece of software that's 6+ years old, there will be development directions that worked and development directions that didn't. The Jx stuff didn't work because it caused way too many compilation related issues (all the Jx classes were subclasses of Node).

My suggestion is to read Simply Lift (http://simply.liftweb.net). It is up to date.

Naftoli Gugenheim

unread,
Jan 9, 2013, 11:27:33 PM1/9/13
to liftweb
You can use reactive-web's DomMutationRenderer to render javascript that inserts html.

Reply all
Reply to author
Forward
0 new messages