Permalink
Browse files

updated readme

  • Loading branch information...
1 parent e11e401 commit aeb0e9cbe2016efec3066b795f53e17bd78412f4 @tmpvar committed Jan 18, 2011
Showing with 73 additions and 4 deletions.
  1. +73 −4 README.md
View
77 README.md
@@ -1,27 +1,96 @@
# jsdom
-CommonJS implementation of the DOM intended to be platform independent and as minimal/light as possible while completely adhering to the w3c DOM specifications.
+CommonJS implementation of the DOM intended to be platform independent and as minimal/light as
+possible while completely adhering to the w3c DOM specifications.
Currently Implemented and w3c Compliant:
- DOM Level 1 (html/svg/xml)
- - DOM Level 2 (html/events)
+ - DOM Level 2 (html/events) with partial level2/core support
- Browser (BOM) Augmentation (getElementsByClassName, getElementById, etc..)
-
**Note**: Running the tests now requires [mjsunit.runner][]
-see: [testlog][] for w3 test compliance
+see: [mailing list][]
+
+see: [testlog][] for w3/jsdom test compliance
see: [plan][] for roadmap and thoughts about this project
see: [project site][] for additional information
+ [mailing list]: http://groups.google.com/group/jsdom
[project site]: http://www.jsdom.org
[mjsunit.runner]: http://github.com/tmpvar/mjsunit.runner
[testlog]: http://github.com/tmpvar/jsdom/blob/master/test/testlog.txt
[plan]: http://github.com/tmpvar/jsdom/blob/master/PLAN.md
+# Flexibility
+
+One of the stated goals of jsdom is to be as minimal and light as possible. This section details how
+someone can change the behavior of `Document`s on the fly. These features are baked into
+the `DOMImplementation` that every `Document` has. These features can be tweaked in two ways:
+
+1. When you create a new `Document` using the jsdom builder (`require('jsdom').jsdom()`)
+
+ var jsdom = require('jsdom').jsdom,
+ doc = jsdom("<html><body></body></html>", null, {
+ features: {
+ FetchExternalResources : ['img']
+ }
+ });
+
+ Do note, that this will only affect the document that is currently being created. All other documents
+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'],
+ ProcessExternalResources : false,
+ MutationEvents : false,
+ QuerySelector : false
+ }
+
+
+
+## Default Features
+
+Default features are extremely important for jsdom as they lower the configuration requirement and present developers a set of consistent default behaviors. The following sections detail the available features, their defaults, and the values that jsdom uses.
+
+
+### FetchExternalResources
+**Default**: ['script']
+
+**Allowed**: ['script', 'img', 'css', 'frame', 'link'] or false
+
+Enables/Disables fetching files over the filesystem/http
+
+### ProcessExternalResources
+**Default** ['script']
+
+**Allowed** ['script'] or false
+
+By default, jsdom executes text content in a SCRIPT and the text retrieved from fetching data from a SCRIPT.src. Turning it off will disable script execution (currently only javascript)
+
+Support for frames is in the works
+
+
+### MutationEvents
+**Default** : '2.0'
+
+**Allowed** : '2.0' or false
+
+Initially enabled to be up to spec. Disable this if you do not need mutation events and want jsdom to be a bit more efficient.
+
+### QuerySelector
+**Default** : false
+
+**Allowed** : true
+
+This feature is backed by [sizzle][]
+
+[sizzle]: http://sizzlejs.com/ but currently causes problems with some libraries. Enable if you want `document.querySelector` and friends, but be aware that many libraries feature detect for this, and it may cause you a bit of trouble.
# Examples

0 comments on commit aeb0e9c

Please sign in to comment.