Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated readme with some important updates

  • Loading branch information...
commit 0df8ca523e3bf5a56d60d180e6da3a9c86572c07 1 parent 49e0e37
@tmpvar authored
Showing with 35 additions and 0 deletions.
  1. +35 −0 README.md
View
35 README.md
@@ -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"),
Please sign in to comment.
Something went wrong with that request. Please try again.