Skip to content

Commit

Permalink
updated readme with some important updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tmpvar committed Sep 18, 2010
1 parent 49e0e37 commit 0df8ca5
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions README.md
Expand Up @@ -24,6 +24,41 @@ see: [project site][] for additional information

# Examples

## Creating a document-less window
<pre>
var jsdom = require("jsdom"),
window = jsdom.createWindow();

console.log(window.document);
// output: undefined
</pre>

## Creating a window+document with html
<pre>
var jsdom = require("jsdom"),
window = jsdom.createWindow("<html><head></head><body>hello world</body></html>", jsdom.defaultLevel);

console.log(window.document.innerHTML);
// output: '<html><head></head><body>hello world</body></html>'
</pre>

## Creating a browser-like DOM/Window

<pre>
var jsdom = require("jsdom"),
window = jsdom.jsdom().createWindow();

window.document.innerHTML = "<html><head></head><body>hello world</body></html>";
console.log(window.document.innerHTML);
// output: '<html><head></head><body>hello world</body></html>'

console.log(window.innerWidth)
// output: 1024

console.log(typeof window.document.getElementsByClassName);
// outputs: function
</pre>

## jQuery
<pre>
var sys = require("sys"),
Expand Down

0 comments on commit 0df8ca5

Please sign in to comment.