Permalink
Browse files

updated README, bump version (0.2.1), and removed old files

  • Loading branch information...
1 parent 9cdd208 commit deaedc1c5077e1d085032add6f1b4305bee06778 @tmpvar committed Jul 22, 2011
Showing with 133 additions and 148 deletions.
  1. +52 −56 README.md
  2. 0 changelog
  3. +81 −58 package.json
  4. +0 −8 test/env.html
  5. +0 −1 test/status.json
  6. +0 −14 test/testlog.txt
  7. +0 −11 wscript
View
108 README.md
@@ -1,4 +1,4 @@
-# jsdom 0.2.0
+# jsdom 0.2.1
A javascript implementation of the W3C DOM.
@@ -20,84 +20,80 @@ with URL
// Count all of the links from the nodejs build page
var jsdom = require("jsdom");
-
- jsdom.env("http://nodejs.org/dist/",
- [
- 'http://code.jquery.com/jquery-1.5.min.js'
- ],
- function(errors, window) {
- console.log("there have been", window.$("a").length, "nodejs releases!");
- });
+
+ jsdom.env("http://nodejs.org/dist/", [
+ 'http://code.jquery.com/jquery-1.5.min.js'
+ ],
+ function(errors, window) {
+ console.log("there have been", window.$("a").length, "nodejs releases!");
+ });
or with raw html
// Run some jQuery on a html fragment
var jsdom = require('jsdom');
-
- jsdom.env('<p><a class="the-link" href="http://jsdom.org>JSDOM\'s Homepage</a></p>',
- [
- 'http://code.jquery.com/jquery-1.5.min.js'
- ],
- function(errors, window) {
- console.log("contents of a.the-link:", window.$("a.the-link").text());
- });
+
+ jsdom.env('<p><a class="the-link" href="http://jsdom.org>JSDOM\'s Homepage</a></p>', [
+ 'http://code.jquery.com/jquery-1.5.min.js'
+ ],
+ function(errors, window) {
+ console.log("contents of a.the-link:", window.$("a.the-link").text());
+ });
+
or with a configuration object
// Print all of the news items on hackernews
var jsdom = require('jsdom');
-
+
jsdom.env({
- html: 'http://news.ycombinator.com/',
- scripts: [
- 'http://code.jquery.com/jquery-1.5.min.js'
- ],
- done: function(errors, window) {
- var $ = window.$;
- console.log('HN Links');
- $('td.title:not(:last) a').each(function() {
- console.log(' -', $(this).text());
- });
- }
- });
+ html: 'http://news.ycombinator.com/',
+ scripts: [
+ 'http://code.jquery.com/jquery-1.5.min.js'
+ ],
+ done: function(errors, window) {
+ var $ = window.$;
+ console.log('HN Links');
+ $('td.title:not(:last) a').each(function() {
+ console.log(' -', $(this).text());
+ });
+ }
+ });
or with raw javascript source
// Print all of the news items on hackernews
- var jsdom = require('jsdom');
-
- var jquery = fs.readFileSync("./jquery-1.5.min.js");
+ var jsdom = require('jsdom');
+ var fs = require('fs');
+ var jquery = fs.readFileSync("./jquery-1.6.2.min.js").toString();
jsdom.env({
- html: 'http://news.ycombinator.com/',
- src: [
- jquery
- ],
- done: function(errors, window) {
- var $ = window.$;
- console.log('HN Links');
- $('td.title:not(:last) a').each(function() {
- console.log(' -', $(this).text());
- });
- }
- });
+ html: 'http://news.ycombinator.com/',
+ src: [
+ jquery
+ ],
+ done: function(errors, window) {
+ var $ = window.$;
+ console.log('HN Links');
+ $('td.title:not(:last) a').each(function() {
+ console.log(' -', $(this).text());
+ });
+ }
+ });
### How it works
`jsdom.env` is built for ease of use, which is rare in the world of the DOM! Since the web has some absolutely horrible javascript on it, as of jsdom 0.2.0 `jsdom.env` will not process external resources (scripts, images, etc). If you want to process the javascript use one of the methods below (`jsdom.jsdom` or `jsdom.jQueryify`)
- jsdom.env(html, [scripts], [options], callback)
+ jsdom.env(html, [scripts], [config], callback)
- `html` (**required**)
May be a url, html fragment, or file
- `scripts` (**optional**)
May contain files or urls
- - `src` (**optional**)
- May contain JavaScript
-
- `callback` (**required**)
- Takes 2 arguments:
+ Takes 2 arguments:
- `errors` : array of errors
- `window` : a brand new window
@@ -110,7 +106,7 @@ If you would like to specify a configuration object
- config.html : see `html` above
- config.scripts : see `scripts` above
- - config.src : see `src` above
+ - config.src : An array of javascript strings that will be evaluated against the resulting document. Similar to `scripts`, but it accepts javascript instead of paths/urls.
- config.done : see `callback` above
## For the hardcore
@@ -120,14 +116,14 @@ If you want to spawn a document/window and specify all sorts of options this is
var jsdom = require("jsdom").jsdom,
doc = jsdom(markup, level, options),
window = doc.createWindow();
-
+
- `markup` is a full html/xml document to be parsed
- `level` is `null` (which means level3) by default, but you can pass another level if you'd like.
var jsdom = require('jsdom'),
doc = jsdom.jsdom('<html><body></body></html>', jsdom.dom.level1.core)
-
+
- `options` see the **Flexibility** section below
### Flexibility
@@ -149,9 +145,9 @@ the `DOMImplementation` that every `Document` has, and may be tweaked in two way
will use the defaults specified below (see: Default Features)
2. Previous to creating any documents you can modify the defaults for all future documents
-
+
require('jsdom').defaultDocumentFeatures = {
- FetchExternalResources : ['script'],
+ FetchExternalResources : ['script'],
ProcessExternalResources : false,
MutationEvents : false,
QuerySelector : false
@@ -173,7 +169,7 @@ Enables/Disables fetching files over the filesystem/http
`ProcessExternalResources`
_default_: ['script']
_allowed_: ['script'] or false
-
+
Disabling this will disable script execution (currently only javascript).
`MutationEvents`
View
0 changelog
No changes.
View
139 package.json
@@ -1,67 +1,90 @@
{
"name": "jsdom",
- "version": "0.2.0",
+ "version": "0.2.1",
"description": "A javascript implementation of the W3C DOM",
"keywords": [
- "dom",
- "w3c",
- "javascript"
- ],
- "maintainers": [
- {
- "name": "Elijah Insua",
- "email": "tmpvar@gmail.com",
- "web": "http://tmpvar.com"
- }
+ "dom",
+ "w3c",
+ "javascript"
],
+ "maintainers": [{
+ "name": "Elijah Insua",
+ "email": "tmpvar@gmail.com",
+ "web": "http://tmpvar.com"
+ }],
"contributors": [
- {
- "name": "Vincent Greene",
- "email": "ulteriorlife@gmail.com"
- },
- {
- "name": "Dav Glass",
- "email": "davglass@gmail.com"
- },
- {
- "name": "Felix Gnass",
- "email": "fgnass@gmail.com"
- },
- {
- "name" : "Charlie Robbins",
- "email": "charlie.robbins@gmail.com"
- },
- {
- "name" : "Aria Stewart",
- "email": "aredridel@nbtsc.org"
- },
- {
- "name" : "Matthew (http://github.com/matthewpflueger/)",
- "email": "N.A."
- },
- {
- "name" : "Olivier El Mekki (http://blog.olivier-elmekki.com/)",
- "email" : "unknown"
- },
- {
- "name" : "Shimon Dookdin",
- "email" : "helpmepro1@gmail.com"
- },
- {
- "name" : "Daniel Cassidy (http://www.danielcassidy.me.uk/)",
- "email" : "mail@danielcassidy.me.uk"
- },
- {
- "name" : "Sam Ruby (http://intertwingly.net/blog/)",
- "email" : "N/A"
- },
- {
- "name" : "hij1nx (http://github.com/hij1nx)"
- },
- {
- "name" : "Karuna Sagar",
- "email" : "karunasagark@gmail.com"
- }
+ {
+ "name": "Vincent Greene",
+ "email": "ulteriorlife@gmail.com"
+ },
+ {
+ "name": "Dav Glass",
+ "email": "davglass@gmail.com"
+ },
+ {
+ "name": "Felix Gnass",
+ "email": "fgnass@gmail.com"
+ },
+ {
+ "name" : "Charlie Robbins",
+ "email": "charlie.robbins@gmail.com"
+ },
+ {
+ "name" : "Aria Stewart",
+ "email": "aredridel@nbtsc.org"
+ },
+ {
+ "name" : "Matthew (http://github.com/matthewpflueger/)",
+ "email": "N.A."
+ },
+ {
+ "name" : "Olivier El Mekki (http://blog.olivier-elmekki.com/)",
+ "email" : "unknown"
+ },
+ {
+ "name" : "Shimon Dookdin",
+ "email" : "helpmepro1@gmail.com"
+ },
+ {
+ "name" : "Daniel Cassidy (http://www.danielcassidy.me.uk/)",
+ "email" : "mail@danielcassidy.me.uk"
+ },
+ {
+ "name" : "Sam Ruby (http://intertwingly.net/blog/)",
+ "email" : "N/A"
+ },
+ {
+ "name" : "hij1nx (http://github.com/hij1nx)"
+ },
+ {
+ "name" : "Daniel Cassidy",
+ "email" : "mail@danielcassidy.me.uk"
+ },
+ {
+ "name" : "Yonathan Randolph (http://github.com/yonran)"
+ },
+ {
+ "name" : "Martin Davis (http://github.com/waslogic)"
+ },
+ {
+ "name": "Andreas Lind Petersen",
+ "email": "andreas@one.com"
+ },
+ {
+ "name" : "d-ash (http://github.com/d-ash)"
+ },
+ {
+ "name" : "Robin",
+ "email" : "fbzhong@gmail.com"
+ },
+ {
+ "name" : "Alexander Flatter",
+ "email" : "flatter@gmail.com"
+ },
+ {
+ "name" : "Heng Liu",
+ "email" : "liucougar@gmail.com"
+ }
],
"bugs": {
"mail": "tmpvar@gmail.com",
View
8 test/env.html
@@ -1,8 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <title>hello, Node.js!</title>
- </head>
- <body>
- </body>
-</html>
View
1 test/status.json
@@ -1 +0,0 @@
-{"total":3069,"pass":2451,"fail":618}
View
14 test/testlog.txt
@@ -1,14 +0,0 @@
-
-level1/core 527/527 100% passing
-level1/html 238/238 100% passing
-level1/svg 527/527 100% passing
-level2/core 160/283 56% passing
-level2/events 35/35 100% passing
-level2/html 685/685 100% passing
-level3/core 0/722 0% passing
-browser 13/13 100% passing
-window 1/1 100% passing
-jsdom 6/6 100% passing
---------------------------------------------
-TOTALS: 2192/3037 72% passing
-
View
11 wscript
@@ -1,11 +0,0 @@
-import Options
-import os
-
-VERSION = '0.0.1'
-
-def test(ctx):
- out = os.popen('node test/runner.js --json').read()
- print out;
-
-def testToJson(ctx):
- os.popen('node test/runner.js --json > ./testToJson.json')

0 comments on commit deaedc1

Please sign in to comment.