From 34f553940cd5e9fba5ca6062333f42ba741b700a Mon Sep 17 00:00:00 2001 From: nanalelfe Date: Sun, 24 Jul 2016 23:14:34 -0400 Subject: Fixed /send_message error/success message show up. --- node_modules/jsdom/README.md | 435 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 435 insertions(+) create mode 100644 node_modules/jsdom/README.md (limited to 'node_modules/jsdom/README.md') diff --git a/node_modules/jsdom/README.md b/node_modules/jsdom/README.md new file mode 100644 index 0000000..b5b00ac --- /dev/null +++ b/node_modules/jsdom/README.md @@ -0,0 +1,435 @@ +# jsdom + +A JavaScript implementation of the WHATWG DOM and HTML standards. + +## Install + +```bash +$ npm install jsdom +``` + +If this gives you trouble with errors about installing Contextify, especially on Windows, see [below](#contextify). + +## Human contact + +see: [mailing list](http://groups.google.com/group/jsdom) + +## Easymode: `jsdom.env` + +`jsdom.env` is an API that allows you to throw a bunch of stuff at it, and it will generally do the right thing. + +You can use it with a URL + +```js +// Count all of the links from the Node.js build page +var jsdom = require("jsdom"); + +jsdom.env( + "http://nodejs.org/dist/", + ["http://code.jquery.com/jquery.js"], + function (errors, window) { + console.log("there have been", window.$("a").length, "nodejs releases!"); + } +); +``` + +or with raw HTML + +```js +// Run some jQuery on a html fragment +var jsdom = require("jsdom"); + +jsdom.env( + '

jsdom!

', + ["http://code.jquery.com/jquery.js"], + function (errors, window) { + console.log("contents of a.the-link:", window.$("a.the-link").text()); + } +); +``` + +or with a configuration object + +```js +// Print all of the news items on Hacker News +var jsdom = require("jsdom"); + +jsdom.env({ + url: "http://news.ycombinator.com/", + scripts: ["http://code.jquery.com/jquery.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 + +```js +// Print all of the news items on Hacker News +var jsdom = require("jsdom"); +var fs = require("fs"); +var jquery = fs.readFileSync("./jquery.js", "utf-8"); + +jsdom.env({ + url: "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 + +The do-what-I-mean API is used like so: + +```js +jsdom.env(string, [scripts], [config], callback); +``` + +- `string`: may be a URL, file name, or HTML fragment +- `scripts`: a string or array of strings, containing file names or URLs that will be inserted as ` +``` + +For more details, see the discussion in [#640](https://github.com/tmpvar/jsdom/issues/640), especially [@matthewkastor](https://github.com/matthewkastor)'s [insightful comment](https://github.com/tmpvar/jsdom/issues/640#issuecomment-22216965). + +### On running scripts and being safe + +By default, `jsdom.env` will not process and run external JavaScript, since our sandbox is not foolproof. That is, code running inside the DOM's `