npm install jquery

9,226 views
Skip to first unread message

AJ ONeal

unread,
Nov 4, 2010, 11:18:43 PM11/4/10
to node.js mailing list
Someone had to do it sometime, so I took the liberty of wrapping jQuery.

    npm install jquery
   
    var $ = require('jquery');
   
    $("<h1>test passes</h1>").appendTo("body");
    console.log($("body").html());

AJ ONeal

Elijah Insua

unread,
Nov 4, 2010, 11:23:43 PM11/4/10
to nod...@googlegroups.com, node.js mailing list
What are you using for a DOM/BOM?
--
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.

Isaac Schlueter

unread,
Nov 4, 2010, 11:48:00 PM11/4/10
to nod...@googlegroups.com
On Thu, Nov 4, 2010 at 20:23, Elijah Insua <tmp...@gmail.com> wrote:
> What are you using for a DOM/BOM?

Looks like jsdom.

@AJ:

Pretty sure John Resig wrote jQuery, not Douglas Crockford.

$ npm view jquery
npm info it worked if it ends with ok
npm info using n...@0.2.5-1
npm info view jquery
{ name: 'jquery'
, description: 'jQuery: The Write Less, Do More, JavaScript Library'
, 'dist-tags': { latest: '1.4.3' }
, versions:
{ '1.4.3':
{ name: 'jquery'
, description: 'jQuery: The Write Less, Do More, JavaScript Library'
, url: 'jquery.com'
, keywords:
[ 'util'
, 'dom'
, 'jquery'
]
, author: 'Douglas Crockford <cool...@gmail.com> (packaged by
AJ ONeal <cool...@gmail.com>)'
, contributors: []
, dependencies: { jsdom: '*' }
, lib: 'lib'
, main: './lib/jquery-1.4.3'
, version: '1.4.3'
, engines: { node: '*' }
, dist: { tarball: 'http://registry.npmjs.org/jquery/-/jquery-1.4.3.tgz' }
}
}
, maintainers: [ 'coolaj86 <cool...@gmail.com>' ]
, author: 'Douglas Crockford <cool...@gmail.com> (packaged by AJ
ONeal <cool...@gmail.com>)'
}
npm ok

--i

AJ ONeal

unread,
Nov 5, 2010, 12:50:53 AM11/5/10
to nod...@googlegroups.com
@AJ:

Pretty sure John Resig wrote jQuery, not Douglas Crockford.

 
yeah, I fixed that.

copy/paste-o (from  remedial earlier)


I also fixed it so that
  jQuery = require('jquery').create();

and

  jQuery2 = require('jquery').create(jsdom().createWindow());

produce separate instances.


  $ = require('jquery');

also works


AJ ONeal

AJ ONeal

unread,
Nov 5, 2010, 12:55:37 AM11/5/10
to nod...@googlegroups.com
jsdom for DOM/BOM

I'm waiting a few days to see if the creator of XMLHttpRequest will update and publish to npm.

If not, I think I can make a quick wrapper using AbstractHttpRequest (same API as `request`).

AJ ONeal

Vekz

unread,
Nov 5, 2010, 6:38:06 PM11/5/10
to nodejs
Nice AJ, you beat me too it. And way more elegantly apparently I had
no idea wtf I was doing.

On Nov 4, 9:55 pm, AJ ONeal <coola...@gmail.com> wrote:
> jsdom for DOM/BOM
>
> I'm waiting a few days to see if the creator of XMLHttpRequest will update
> and publish to npm.
>
> If not, I think I can make a quick wrapper using AbstractHttpRequest (same
> API as `request`).
>
> AJ ONeal
>
>
>
>
>
>
>
> On Thu, Nov 4, 2010 at 9:23 PM, Elijah Insua <tmp...@gmail.com> wrote:
> > What are you using for a DOM/BOM?
>
> > On Nov 4, 2010, at 11:18 PM, AJ ONeal <coola...@gmail.com> wrote:
>
> > Someone had to do it sometime, so I took the liberty of wrapping jQuery.
>
> >     npm install jquery
>
> >     var $ = require('jquery');
>
> >     $("<h1>test passes</h1>").appendTo("body");
> >     console.log($("body").html());
>
> > AJ ONeal
>
> > --
> > 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.
>
> >  --
> > 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<nodejs%2Bunsu...@googlegroups.com>
> > .

David Tang

unread,
Dec 5, 2010, 10:39:19 PM12/5/10
to nodejs
Does anyone else have problems with navigator and location being
undefined? I had to prepend "window." to every occurrence to get this
to work.

YANG Xudong

unread,
Dec 5, 2010, 10:58:29 PM12/5/10
to nod...@googlegroups.com
I'm not sure about this, but shouldn't that supposed to be correct behavior? You could omit the 'window.' in browser JavaScript since window is the global object, while in server-side JavaScript this is no longer the case.
=======================
杨旭东 YANG Xudong "Wyverald"
Juntos, unidos, triunfará nuestro deseo de ser el mejor
alias please=sudo
please rm -rf /

AJ ONeal

unread,
Dec 7, 2010, 2:29:47 PM12/7/10
to nod...@googlegroups.com
Please send me a pull request on github, otherwise I'll fix it when I get around to it.

I just updated jquery in npm from someone else's push.

However, since I'm following the jquery version number you'll have to uninstall and reinstall to get the latest version.

AJ ONeal
(317) 426-6525
Reply all
Reply to author
Forward
0 new messages