Hi all,
I finished up the abstraction of JavaScript artifacts within lift core
code. Please see wip-marius-jslib branch. As I said in a previous
thread I tested it with YUI:
1. Comet
2. Ajax (ajax forms, notice etc)
3. JSon (json handler)
4. Etc.
So ... what did I do ...
1. Made a trait net.liftweb.http.js.JsArtifacts - basically this
abstract the JS operations that lift core code used but were dependent
on JQuery
2. Added LiftRules.jsArtifacts variablewhich by default points to the
JQuery implementation of JSArtifacts
(net.liftweb.http.js.jquery.JQueryArtifacts). It can be changed in
Boot to point to net.liftweb.http.js.yui.YUIArtifacts
3. In lift core classes I used LiftRules.jsArtifacts where JQuery was
used directly
4. Stuff from JsCommands.scala (JSExp's, JsCmd's etc) that were
specific to JQuery are now in
net.liftweb.http.js.jquery.JQueryCommands.scala. So because of this
your current application will fail tocompile if you're using such
JSExp's,JsCmd's etc. To fix this just add the appropriate imports
(import JqJE._, import JqJsCmds._ etc).
5. I moved the autocomplete stuff from SHtml to
net.liftweb.http.jquery.JqSHtml as this heavily depends on JQuery. I'm
not sure if everyone agrees with this it is just a proposal. I'm
opened to better ideas though.
6. Added liftYUI.js .. this is necessary when using YUI. The
motivation is that YUI doesn;t have some cool features that JQuery has
(at least I could not find them). For instance lift Ajax and Comet
typically uses JavaScript mime type as response. JQuery is smart
enough to know this and execute the JS payload. YUI connection-manager
just passes the content to the callback function. So liftYUI.js
contains the eval function which is inspired from JQuery
implementation which is inspired from
http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
. There are of course other things that I could not find in YUI as
simple artifacts like toggle. etc.
7. To use lift with yui the YUI scripts dependency is:
yahoo.js, event.js, dom.js, connection.js, json.js (YAHOO's script),
liftYUI.js
8. I added YUI scripts to be accepted by ResourceServer
I'll post soon a lift example that uses YUI on wiki.
Thoughts are always welcomed !
P.S.
This is not in the master branch until reviews are done and agreed.
Br's,
Marius