Run jquery/zepto commands on the server

50 views
Skip to first unread message

Tom Blobaum

unread,
Sep 25, 2011, 1:49:53 PM9/25/11
to nod...@googlegroups.com
All-

I just put this module together, basically it allows you to run jquery style commands from the server.  
I'd like to know if anyone else is interested in this, if I should develop it further, etc.  Currently you can only set elements, but cannot get them or execute callbacks.  It should be possible to have that as well, so it basically feels like writing jquery code except it's all on the server.  For now, it's a good solution for rendering templates on the server and dropping them in when/where as needed.

Thanks,

Mark Hahn

unread,
Sep 25, 2011, 3:27:19 PM9/25/11
to nod...@googlegroups.com
FWIW ...

I have been using a fake jQuery for six months.  But it only emulates the ajax calls through node requests.  The reason I did it is so that code designed to run in a browser with ajax will work with node.  In particular I am using it with the standard jquery client for couchdb.  This has allowed me to run identical db code in the browser and node.

If you want to add my functionality let me know.  I would have to do some work to make it general.  Or you could just rewrite it yourself as it was pretty easy.  Then I could use your supported version.

One quick note.  There was one part of ajax that was impossible to implement.  That was the sync version of the ajax call.  I will never forgive Microsoft for including a sync version and I will not forgive the couch programmer for using it for one feature.  I have avoided that feature in my app.

Tom Blobaum

unread,
Sep 25, 2011, 8:56:09 PM9/25/11
to nod...@googlegroups.com
I just pushed a new version https://github.com/tblobaum/nodeQuery

You can now bind events to the DOM from the server, get attributes, and some misc other features


    $('.clickable').live('click', function () {
        $('.clickable').html('You clicked it!');
        $('.clickable').attr('href', console.log);
    });

    $('.container').append('<span class="hoverable">Hover me.</span>');

    $('.hoverable').live('mouseover', function () {
        $('.hoverable').html('You hovered it!');
    });

    $('.hoverable').live('mouseout', function () {
        $('.hoverable').html('Im back again!');
    });

Thomas Blobaum
http://twitter.com/tomblobaum


--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply all
Reply to author
Forward
0 new messages