Skip to content

praized/node-jquery

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-jQuery

A stupid-simple wrapper over jQuery for nodejs. Currently 1.5.

Works in the Browser and in Node.JS.

npm install jquery

var $ = require('jquery');

$("<h1>test passes</h1>").appendTo("body");
console.log($("body").html());

In Node.JS you may also create separate window instances

var jsdom = require('jsdom').jsdom,
  myWindow = jsdom().createWindow(),
  $ = require('jquery'),
  jq = require('jquery').create(),
  jQuery = require('jquery').create(myWindow);

$("<h1>test passes</h1>").appendTo("body");
console.log($("body").html());

jq("<h2>other test passes</h2>").appendTo("body");
console.log(jq("body").html());

jQuery("<h3>third test passes</h3>").appendTo("body");
console.log(jQuery("body").html());

Output:

<h1>test passes</h1>
<h2>other test passes</h2>
<h3>third test passes</h3>

TODO

XMLHttpRequest is not yet in npm, so I'm waiting on that.

I may impmement it on top of AbstractHttpRequest, which is node-request-compatible

About

jQuery with a thin wrapper for Node.JS

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%