Skip to content
This repository
Browse code

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

  • Loading branch information...
commit deaedc1c5077e1d085032add6f1b4305bee06778 1 parent 9cdd208
Elijah Insua authored
108 README.md
Source Rendered
... ... @@ -1,4 +1,4 @@
1   -# jsdom 0.2.0
  1 +# jsdom 0.2.1
2 2
3 3 A javascript implementation of the W3C DOM.
4 4
@@ -20,72 +20,71 @@ with URL
20 20
21 21 // Count all of the links from the nodejs build page
22 22 var jsdom = require("jsdom");
23   -
24   - jsdom.env("http://nodejs.org/dist/",
25   - [
26   - 'http://code.jquery.com/jquery-1.5.min.js'
27   - ],
28   - function(errors, window) {
29   - console.log("there have been", window.$("a").length, "nodejs releases!");
30   - });
  23 +
  24 + jsdom.env("http://nodejs.org/dist/", [
  25 + 'http://code.jquery.com/jquery-1.5.min.js'
  26 + ],
  27 + function(errors, window) {
  28 + console.log("there have been", window.$("a").length, "nodejs releases!");
  29 + });
31 30
32 31 or with raw html
33 32
34 33 // Run some jQuery on a html fragment
35 34 var jsdom = require('jsdom');
36   -
37   - jsdom.env('<p><a class="the-link" href="http://jsdom.org>JSDOM\'s Homepage</a></p>',
38   - [
39   - 'http://code.jquery.com/jquery-1.5.min.js'
40   - ],
41   - function(errors, window) {
42   - console.log("contents of a.the-link:", window.$("a.the-link").text());
43   - });
  35 +
  36 + jsdom.env('<p><a class="the-link" href="http://jsdom.org>JSDOM\'s Homepage</a></p>', [
  37 + 'http://code.jquery.com/jquery-1.5.min.js'
  38 + ],
  39 + function(errors, window) {
  40 + console.log("contents of a.the-link:", window.$("a.the-link").text());
  41 + });
  42 +
44 43
45 44 or with a configuration object
46 45
47 46 // Print all of the news items on hackernews
48 47 var jsdom = require('jsdom');
49   -
  48 +
50 49 jsdom.env({
51   - html: 'http://news.ycombinator.com/',
52   - scripts: [
53   - 'http://code.jquery.com/jquery-1.5.min.js'
54   - ],
55   - done: function(errors, window) {
56   - var $ = window.$;
57   - console.log('HN Links');
58   - $('td.title:not(:last) a').each(function() {
59   - console.log(' -', $(this).text());
60   - });
61   - }
62   - });
  50 + html: 'http://news.ycombinator.com/',
  51 + scripts: [
  52 + 'http://code.jquery.com/jquery-1.5.min.js'
  53 + ],
  54 + done: function(errors, window) {
  55 + var $ = window.$;
  56 + console.log('HN Links');
  57 + $('td.title:not(:last) a').each(function() {
  58 + console.log(' -', $(this).text());
  59 + });
  60 + }
  61 + });
63 62
64 63 or with raw javascript source
65 64
66 65 // Print all of the news items on hackernews
67   - var jsdom = require('jsdom');
68   -
69   - var jquery = fs.readFileSync("./jquery-1.5.min.js");
  66 + var jsdom = require('jsdom');
  67 + var fs = require('fs');
  68 + var jquery = fs.readFileSync("./jquery-1.6.2.min.js").toString();
70 69
71 70 jsdom.env({
72   - html: 'http://news.ycombinator.com/',
73   - src: [
74   - jquery
75   - ],
76   - done: function(errors, window) {
77   - var $ = window.$;
78   - console.log('HN Links');
79   - $('td.title:not(:last) a').each(function() {
80   - console.log(' -', $(this).text());
81   - });
82   - }
83   - });
  71 + html: 'http://news.ycombinator.com/',
  72 + src: [
  73 + jquery
  74 + ],
  75 + done: function(errors, window) {
  76 + var $ = window.$;
  77 + console.log('HN Links');
  78 + $('td.title:not(:last) a').each(function() {
  79 + console.log(' -', $(this).text());
  80 + });
  81 + }
  82 + });
84 83
85 84 ### How it works
86 85 `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`)
87 86
88   - jsdom.env(html, [scripts], [options], callback)
  87 + jsdom.env(html, [scripts], [config], callback)
89 88
90 89 - `html` (**required**)
91 90 May be a url, html fragment, or file
@@ -93,11 +92,8 @@ or with raw javascript source
93 92 - `scripts` (**optional**)
94 93 May contain files or urls
95 94
96   - - `src` (**optional**)
97   - May contain JavaScript
98   -
99 95 - `callback` (**required**)
100   - Takes 2 arguments:
  96 + Takes 2 arguments:
101 97 - `errors` : array of errors
102 98 - `window` : a brand new window
103 99
@@ -110,7 +106,7 @@ If you would like to specify a configuration object
110 106
111 107 - config.html : see `html` above
112 108 - config.scripts : see `scripts` above
113   - - config.src : see `src` above
  109 + - 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.
114 110 - config.done : see `callback` above
115 111
116 112 ## For the hardcore
@@ -120,14 +116,14 @@ If you want to spawn a document/window and specify all sorts of options this is
120 116 var jsdom = require("jsdom").jsdom,
121 117 doc = jsdom(markup, level, options),
122 118 window = doc.createWindow();
123   -
  119 +
124 120 - `markup` is a full html/xml document to be parsed
125 121 - `level` is `null` (which means level3) by default, but you can pass another level if you'd like.
126 122
127 123
128 124 var jsdom = require('jsdom'),
129 125 doc = jsdom.jsdom('<html><body></body></html>', jsdom.dom.level1.core)
130   -
  126 +
131 127 - `options` see the **Flexibility** section below
132 128
133 129 ### Flexibility
@@ -149,9 +145,9 @@ the `DOMImplementation` that every `Document` has, and may be tweaked in two way
149 145 will use the defaults specified below (see: Default Features)
150 146
151 147 2. Previous to creating any documents you can modify the defaults for all future documents
152   -
  148 +
153 149 require('jsdom').defaultDocumentFeatures = {
154   - FetchExternalResources : ['script'],
  150 + FetchExternalResources : ['script'],
155 151 ProcessExternalResources : false,
156 152 MutationEvents : false,
157 153 QuerySelector : false
@@ -173,7 +169,7 @@ Enables/Disables fetching files over the filesystem/http
173 169 `ProcessExternalResources`
174 170 _default_: ['script']
175 171 _allowed_: ['script'] or false
176   -
  172 +
177 173 Disabling this will disable script execution (currently only javascript).
178 174
179 175 `MutationEvents`
0  changelog
No changes.
139 package.json
... ... @@ -1,67 +1,90 @@
1 1 {
2 2 "name": "jsdom",
3   - "version": "0.2.0",
  3 + "version": "0.2.1",
4 4 "description": "A javascript implementation of the W3C DOM",
5 5 "keywords": [
6   - "dom",
7   - "w3c",
8   - "javascript"
9   - ],
10   - "maintainers": [
11   - {
12   - "name": "Elijah Insua",
13   - "email": "tmpvar@gmail.com",
14   - "web": "http://tmpvar.com"
15   - }
  6 + "dom",
  7 + "w3c",
  8 + "javascript"
16 9 ],
  10 + "maintainers": [{
  11 + "name": "Elijah Insua",
  12 + "email": "tmpvar@gmail.com",
  13 + "web": "http://tmpvar.com"
  14 + }],
17 15 "contributors": [
18   - {
19   - "name": "Vincent Greene",
20   - "email": "ulteriorlife@gmail.com"
21   - },
22   - {
23   - "name": "Dav Glass",
24   - "email": "davglass@gmail.com"
25   - },
26   - {
27   - "name": "Felix Gnass",
28   - "email": "fgnass@gmail.com"
29   - },
30   - {
31   - "name" : "Charlie Robbins",
32   - "email": "charlie.robbins@gmail.com"
33   - },
34   - {
35   - "name" : "Aria Stewart",
36   - "email": "aredridel@nbtsc.org"
37   - },
38   - {
39   - "name" : "Matthew (http://github.com/matthewpflueger/)",
40   - "email": "N.A."
41   - },
42   - {
43   - "name" : "Olivier El Mekki (http://blog.olivier-elmekki.com/)",
44   - "email" : "unknown"
45   - },
46   - {
47   - "name" : "Shimon Dookdin",
48   - "email" : "helpmepro1@gmail.com"
49   - },
50   - {
51   - "name" : "Daniel Cassidy (http://www.danielcassidy.me.uk/)",
52   - "email" : "mail@danielcassidy.me.uk"
53   - },
54   - {
55   - "name" : "Sam Ruby (http://intertwingly.net/blog/)",
56   - "email" : "N/A"
57   - },
58   - {
59   - "name" : "hij1nx (http://github.com/hij1nx)"
60   - },
61   - {
62   - "name" : "Karuna Sagar",
63   - "email" : "karunasagark@gmail.com"
64   - }
  16 + {
  17 + "name": "Vincent Greene",
  18 + "email": "ulteriorlife@gmail.com"
  19 + },
  20 + {
  21 + "name": "Dav Glass",
  22 + "email": "davglass@gmail.com"
  23 + },
  24 + {
  25 + "name": "Felix Gnass",
  26 + "email": "fgnass@gmail.com"
  27 + },
  28 + {
  29 + "name" : "Charlie Robbins",
  30 + "email": "charlie.robbins@gmail.com"
  31 + },
  32 + {
  33 + "name" : "Aria Stewart",
  34 + "email": "aredridel@nbtsc.org"
  35 + },
  36 + {
  37 + "name" : "Matthew (http://github.com/matthewpflueger/)",
  38 + "email": "N.A."
  39 + },
  40 + {
  41 + "name" : "Olivier El Mekki (http://blog.olivier-elmekki.com/)",
  42 + "email" : "unknown"
  43 + },
  44 + {
  45 + "name" : "Shimon Dookdin",
  46 + "email" : "helpmepro1@gmail.com"
  47 + },
  48 + {
  49 + "name" : "Daniel Cassidy (http://www.danielcassidy.me.uk/)",
  50 + "email" : "mail@danielcassidy.me.uk"
  51 + },
  52 + {
  53 + "name" : "Sam Ruby (http://intertwingly.net/blog/)",
  54 + "email" : "N/A"
  55 + },
  56 + {
  57 + "name" : "hij1nx (http://github.com/hij1nx)"
  58 + },
  59 + {
  60 + "name" : "Daniel Cassidy",
  61 + "email" : "mail@danielcassidy.me.uk"
  62 + },
  63 + {
  64 + "name" : "Yonathan Randolph (http://github.com/yonran)"
  65 + },
  66 + {
  67 + "name" : "Martin Davis (http://github.com/waslogic)"
  68 + },
  69 + {
  70 + "name": "Andreas Lind Petersen",
  71 + "email": "andreas@one.com"
  72 + },
  73 + {
  74 + "name" : "d-ash (http://github.com/d-ash)"
  75 + },
  76 + {
  77 + "name" : "Robin",
  78 + "email" : "fbzhong@gmail.com"
  79 + },
  80 + {
  81 + "name" : "Alexander Flatter",
  82 + "email" : "flatter@gmail.com"
  83 + },
  84 + {
  85 + "name" : "Heng Liu",
  86 + "email" : "liucougar@gmail.com"
  87 + }
65 88 ],
66 89 "bugs": {
67 90 "mail": "tmpvar@gmail.com",
8 test/env.html
... ... @@ -1,8 +0,0 @@
1   -<!DOCTYPE html>
2   -<html>
3   - <head>
4   - <title>hello, Node.js!</title>
5   - </head>
6   - <body>
7   - </body>
8   -</html>
1  test/status.json
... ... @@ -1 +0,0 @@
1   -{"total":3069,"pass":2451,"fail":618}
14 test/testlog.txt
... ... @@ -1,14 +0,0 @@
1   -
2   -level1/core 527/527 100% passing
3   -level1/html 238/238 100% passing
4   -level1/svg 527/527 100% passing
5   -level2/core 160/283 56% passing
6   -level2/events 35/35 100% passing
7   -level2/html 685/685 100% passing
8   -level3/core 0/722 0% passing
9   -browser 13/13 100% passing
10   -window 1/1 100% passing
11   -jsdom 6/6 100% passing
12   ---------------------------------------------
13   -TOTALS: 2192/3037 72% passing
14   -
11 wscript
... ... @@ -1,11 +0,0 @@
1   -import Options
2   -import os
3   -
4   -VERSION = '0.0.1'
5   -
6   -def test(ctx):
7   - out = os.popen('node test/runner.js --json').read()
8   - print out;
9   -
10   -def testToJson(ctx):
11   - os.popen('node test/runner.js --json > ./testToJson.json')

0 comments on commit deaedc1

Please sign in to comment.
Something went wrong with that request. Please try again.