{"_id":"jsdom-nocontextifiy","_rev":"6-cd5443be054f6746265d3f3f6e35df65","name":"jsdom-nocontextifiy","description":"A javascript implementation of the W3C DOM","dist-tags":{"latest":"0.2.10"},"versions":{"0.2.10":{"name":"jsdom-nocontextifiy","version":"0.2.10","description":"A javascript implementation of the W3C DOM","keywords":["dom","w3c","javascript"],"maintainers":[{"name":"pita","email":"petermartischka@googlemail.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","email":"N.A.","url":"http://github.com/matthewpflueger/"},{"name":"Olivier El Mekki","email":"unknown","url":"http://blog.olivier-elmekki.com/"},{"name":"Shimon Dookdin","email":"helpmepro1@gmail.com"},{"name":"Daniel Cassidy","email":"mail@danielcassidy.me.uk","url":"http://www.danielcassidy.me.uk/"},{"name":"Sam Ruby","email":"N/A","url":"http://intertwingly.net/blog/"},{"name":"hij1nx","url":"http://github.com/hij1nx"},{"name":"Yonathan Randolph","url":"http://github.com/yonran"},{"name":"Martin Davis","url":"http://github.com/waslogic"},{"name":"Andreas Lind Petersen","email":"andreas@one.com"},{"name":"d-ash","url":"http://github.com/d-ash"},{"name":"Robin Zhong","email":"fbzhong@gmail.com"},{"name":"Alexander Flatter","email":"flatter@gmail.com"},{"name":"Heng Liu","email":"liucougar@gmail.com"},{"name":"Brian McDaniel","url":"http://github.com/brianmcd"},{"name":"John Hurliman","email":"jhurliman@jhurliman.org"},{"name":"Jimmy Mabey"},{"name":"Gregory Tomlinson"},{"name":"Jason Davies","url":"http://www.jasondavies.com/"},{"name":"Josh Marshall","url":"http://www.ponderingtheobvious.com/"},{"name":"Jason Priestley","url":"https://github.com/jhp"},{"name":"Derek Lindahl","url":"https://github.com/dlindahl"},{"name":"Chris Roebuck","email":"chris@quillu.com","url":"http://www.quillu.com"}],"bugs":{"email":"tmpvar@gmail.com","url":"http://github.com/tmpvar/jsdom/issues"},"licenses":[{"type":"MIT","url":"http://github.com/tmpvar/jsdom/blob/master/LICENSE.txt"}],"repositories":[{"type":"git","url":"http://github.com/tmpvar/jsdom.git"}],"implements":["http://www.w3.org/TR/REC-DOM-Level-1"],"dependencies":{"htmlparser":"1.x","request":"2.x","cssom":"0.2.x"},"devDependencies":{"nodeunit":">=0.5.x","console.log":"*","optimist":"*"},"engines":{"node":">=0.1.9"},"directories":{"lib":"./lib/jsdom"},"main":"./lib/jsdom","_npmUser":{"name":"pita","email":"petermartischka@googlemail.com"},"_id":"jsdom-nocontextifiy@0.2.10","_engineSupported":true,"_npmVersion":"1.0.106","_nodeVersion":"v0.4.12","_defaultsLoaded":true,"dist":{"shasum":"440bbd5c1836b8f8ae75796a16b218f960397e46","tarball":"https://registry.npmjs.org/jsdom-nocontextifiy/-/jsdom-nocontextifiy-0.2.10.tgz","integrity":"sha512-RU06YnRCp9y70e1/AZeBGqYzx20adKd6w9hQJH4np0WOOyB3tMXDkujxYzEVUrbUDQ6nr8ICk+vCx66TtnGoNA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICQch+UwtdwmJB2JPm1eyCgjX0CJLnnbbbiaDAjbV4EQAiB6UuuAfI8pK+HC6rhY39HQQ6puVN9M/zUMNX+tGECEGw=="}]}}},"readme":"# jsdom\n\nA javascript implementation of the W3C DOM.\n\n## Install\n\n    npm install jsdom\n\nor\n\n    git clone http://github.com/tmpvar/jsdom.git\n    cd jsdom\n    npm link\n\n## Human contact\n\nsee: [mailing list][]\n\n  [mailing list]: http://groups.google.com/group/jsdom\n\n\n\n\n## Easymode\n\nBootstrapping a DOM is generally a difficult process involving many error prone steps. We didn't want jsdom to fall into the same trap and that is why a new method, `jsdom.env()`, has been added in jsdom 0.2.0 which should make everyone's lives easier.\n\nwith URL\n\n    // Count all of the links from the nodejs build page\n    var jsdom = require(\"jsdom\");\n\n    jsdom.env(\"http://nodejs.org/dist/\", [\n      'http://code.jquery.com/jquery-1.5.min.js'\n    ],\n    function(errors, window) {\n      console.log(\"there have been\", window.$(\"a\").length, \"nodejs releases!\");\n    });\n\nor with raw html\n\n    // Run some jQuery on a html fragment\n    var jsdom = require('jsdom');\n\n    jsdom.env('<p><a class=\"the-link\" href=\"http://jsdom.org>JSDOM\\'s Homepage</a></p>', [\n      'http://code.jquery.com/jquery-1.5.min.js'\n    ],\n    function(errors, window) {\n      console.log(\"contents of a.the-link:\", window.$(\"a.the-link\").text());\n    });\n\n\nor with a configuration object\n\n    // Print all of the news items on hackernews\n    var jsdom = require('jsdom');\n\n    jsdom.env({\n      html: 'http://news.ycombinator.com/',\n      scripts: [\n        'http://code.jquery.com/jquery-1.5.min.js'\n      ],\n      done: function(errors, window) {\n        var $ = window.$;\n        console.log('HN Links');\n        $('td.title:not(:last) a').each(function() {\n          console.log(' -', $(this).text());\n        });\n      }\n    });\n\nor with raw javascript source\n\n    // Print all of the news items on hackernews\n    var jsdom  = require('jsdom');\n    var fs     = require('fs');\n    var jquery = fs.readFileSync(\"./jquery-1.6.2.min.js\").toString();\n\n    jsdom.env({\n      html: 'http://news.ycombinator.com/',\n      src: [\n        jquery\n      ],\n      done: function(errors, window) {\n        var $ = window.$;\n        console.log('HN Links');\n        $('td.title:not(:last) a').each(function() {\n          console.log(' -', $(this).text());\n        });\n      }\n    });\n\n### How it works\n  `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`)\n\n    jsdom.env(html, [scripts], [config], callback)\n\n  - `html` (**required**)\n    May be a url, html fragment, or file\n\n  - `scripts` (**optional**)\n    May contain files or urls\n\n  - `callback` (**required**)\n    Takes 2 arguments:\n    - `errors` : array of errors\n    - `window` : a brand new window\n\n    _example:_  jsdom.env(html, function(`errors`, `window`) {})\n\n\nIf you would like to specify a configuration object\n\n    jsdom.env({ /* config */ })\n\n  - config.html     : see `html` above\n  - config.scripts  : see `scripts` above\n  - 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.\n  - config.done     : see `callback` above\n  - config.document :\n   - referer : the new document will have this referer\n   - cookie : manually set a cookie value i.e. `'key=value; expires=Wed, Sep 21 2011 12:00:00 GMT; path=/'`\n  - config.features : see `Flexibility` section below. **Note**: the default feature set for jsdom.env does _not_ include fetching remote javascript and executing it.  This is something that you will need to **carefully** enable yourself.\n\n## For the hardcore\n\nIf you want to spawn a document/window and specify all sorts of options this is the section for you. This section covers the `jsdom.jsdom` method:\n\n    var jsdom  = require(\"jsdom\").jsdom,\n        doc    = jsdom(markup, level, options),\n        window = doc.createWindow();\n\n - `markup` is an html/xml document to be parsed. You can also pass `null` or an undefined value to get a basic document with empty head and body tags. Document fragments are also supported (including `\"\"`), and will behave as sanely as possible (eg. the resulting document will lack the `head`, `body` and `documentElement` properties if the corresponding elements aren't included).\n - `level` is `null` (which means level3) by default, but you can pass another level if you'd like.\n\n\n        var jsdom = require('jsdom'),\n            doc   = jsdom.jsdom('<html><body></body></html>', jsdom.dom.level1.core)\n\n - `options` see the **Flexibility** section below\n\n### Flexibility\n\nOne of the goals of jsdom is to be as minimal and light as possible. This section details how\nsomeone can change the behavior of `Document`s on the fly.  These features are baked into\nthe `DOMImplementation` that every `Document` has, and may be tweaked in two ways:\n\n1. When you create a new `Document` using the jsdom builder (`require('jsdom').jsdom()`)\n\n        var jsdom = require('jsdom').jsdom,\n            doc   = jsdom(\"<html><body></body></html>\", null, {\n              features: {\n                FetchExternalResources : ['img']\n              }\n            });\n\n Do note, that this will only affect the document that is currently being created.  All other documents\nwill use the defaults specified below (see: Default Features)\n\n2. Previous to creating any documents you can modify the defaults for all future documents\n\n        require('jsdom').defaultDocumentFeatures = {\n          FetchExternalResources   : ['script'],\n          ProcessExternalResources : false,\n          MutationEvents           : false,\n          QuerySelector            : false\n        }\n\n\n\n#### Default Features\n\nDefault 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.\n\n\n`FetchExternalResources`\n_Default_: ['script']\n_Allowed_: ['script', 'img', 'css', 'frame', 'link'] or false\n\nEnables/Disables fetching files over the filesystem/http\n\n`ProcessExternalResources`\n_default_: ['script']\n_allowed_: ['script'] or false\n\nDisabling this will disable script execution (currently only javascript).\n\n`MutationEvents`\n_default_: '2.0'\n_allowed_ : '2.0' or false\n\nInitially enabled to be up to spec. Disable this if you do not need mutation events and want jsdom to be a bit more efficient.\n\n**Note**: `ProcessExternalResources` requires this to be enabled\n\n`QuerySelector`\n_default_ : false\n_allowed_ : true\n\nThis feature is backed by [sizzle][] but currently causes problems with some libraries.  Enable this 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.\n\n[sizzle]:http://sizzlejs.com/\n\n# More Examples\n\n## Creating a document-less window\n\n    var jsdom  = require(\"jsdom\"),\n        window = jsdom.createWindow();\n\n    console.log(window.document);\n    // output: undefined\n\n## Creating a document\n    var jsdom = require(\"jsdom\"),\n        doc   = new (jsdom.dom.level1.core.Document)();\n    console.log(doc.nodeName);\n    // outputs: #document\n\n## Creating a browser-like BOM/DOM/Window\n\n    var jsdom    = require(\"./lib/jsdom\").jsdom,\n        document = jsdom(\"<html><head></head><body>hello world</body></html>\"),\n        window   = document.createWindow();\n\n    console.log(window.document.innerHTML);\n    // output: '<html><head></head><body>hello world</body></html>'\n\n    console.log(window.innerWidth)\n    // output: 1024\n\n    console.log(typeof window.document.getElementsByClassName);\n    // outputs: function\n\n\n## jQueryify\n\n    var jsdom  = require(\"jsdom\"),\n        window = jsdom.jsdom().createWindow();\n\n    jsdom.jQueryify(window, 'http://code.jquery.com/jquery-1.4.2.min.js' , function() {\n      window.$('body').append('<div class=\"testing\">Hello World, It works</div>');\n      console.log(window.$('.testing').text());\n    });\n\n# Test Compliance:\n\n     level1/core        531/531      100%\n     level1/html        238/238      100%\n     level1/svg         527/527      100%\n     level2/core        283/283      100%\n     level2/html        687/687      100%\n     level2/style           4/4      100%\n     level2/extra           4/4      100%\n     level3/xpath         93/93      100%\n     window/index           5/5      100%\n     window/script          8/8      100%\n     window/frame         14/14      100%\n     sizzle/index         12/15       80%\n     jsdom/index          63/63      100%\n    --------------------------------------\n    TOTALS: 3/2472 failed; 99% success\n    TIME: 16730ms\n\n## Running the tests\n\nFirst you'll want to `npm install -g nodeunit` then `npm install --dev`\n\nUsing `test/runner` you can slice and dice which tests your want to run from different levels. Usage is as follows:\n\n    test/runner --help\n    Run the jsdom test suite\n\n    Options:\n    -s, --suites     suites that you want to run. ie: -s level1/core,1/html,html [string]\n    -f, --fail-fast  stop on the first failed test\n    -h, --help       show the help\n    -t, --tests      choose the test cases to run. ie: -t jquery","maintainers":[{"name":"pita","email":"petermartischka@googlemail.com"}],"time":{"modified":"2022-06-19T05:58:53.404Z","created":"2011-12-04T15:54:03.817Z","0.2.10":"2011-12-04T15:54:05.970Z"},"users":{"rifaqat":true}}