-
Notifications
You must be signed in to change notification settings - Fork 28
/
package.json
39 lines (39 loc) · 2.59 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{
"name": "domtosource",
"version": "0.0.2",
"description": "This module wraps around Cheerio and magically calculates the line and column numbers where DOM elements appear in the HTML source code.",
"keywords": [
"html",
"cheerio",
"jquery"
],
"homepage": "https://github.com/keeganstreet/domtosource",
"author": {
"name": "Keegan Street",
"url": "http://keegan.st"
},
"repository": {
"type": "git",
"url": "https://github.com/keeganstreet/domtosource.git"
},
"bugs": {
"url": "https://github.com/keeganstreet/domtosource/issues"
},
"main": "app",
"engines": {
"node": "~0.8.x"
},
"scripts": {
"test": "node_modules/.bin/mocha test/test.js"
},
"dependencies": {
"cheerio": "0.10.x"
},
"devDependencies": {
"mocha": "1.3.x"
},
"readme": "# DOM to Source\n\nThis module wraps around Cheerio and magically calculates the line and column number where DOM elements appear in the HTML source code.\n\n## Usage\n\n```js\nvar fs = require('fs'),\n domtosource = require('domtosource'),\n doc = fs.readFileSync('file.html', 'utf8'),\n results = domtosource.find(doc, '.green', true);\n```\n\n## Inputs\n\nIn the usage example above, you can see that domtosource.find() takes three parameters.\n\n1) The HTML source code to search in\n\n2) The CSS selector to search for\n\n3) true if you want to calculate the line and column numbers\n\n## Return values\n\nDomToSource returns an array containing the elements that matched your selector, and their line and column numbers in the HTML source:\n\n```js\n[\n {\n el: { '0': [Object], length: 1 },\n html: '<li class=\"green\">Green <span class=\"green\">test</span></li>',\n line: 12,\n column: 5,\n calculationMethod: 'methodA'\n },\n {\n \tel: { '0': [Object], length: 1 },\n html: '<span class=\"green\">test</span>',\n line: 12,\n column: 29,\n calculationMethod: 'methodA'\n },\n {\n \tel: { '0': [Object], length: 1 },\n html: '<li class=\"green\">Green</li>',\n line: 16,\n column: 5,\n calculationMethod: 'methodB'\n \t},\n {\n \tel: { '0': [Object], length: 1 },\n html: '<li class=\"green\">Green</li>',\n line: 17,\n column: 5,\n calculationMethod: 'methodB'\n }\n]\n```\n\nThe calculation method return value indicates which method was used to calculate the line and column number. This is used for unit test purposes because some methods are faster than others, but only work in certain situations. It is not something you need to worry about as a user.\n",
"readmeFilename": "readme.md",
"_id": "domtosource@0.0.2",
"_from": "domtosource"
}