한요섭

1206

Showing 1000 changed files with 4669 additions and 71 deletions

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

...@@ -178,6 +178,12 @@ function get_genre_code(genre_str) { ...@@ -178,6 +178,12 @@ function get_genre_code(genre_str) {
178 function get_year_num(year){ 178 function get_year_num(year){
179 var return_year; 179 var return_year;
180 switch (year) { 180 switch (year) {
181 + case "1960년대":
182 + return_year = 1960;
183 + break;
184 + case "1970년대":
185 + return_year = 1970;
186 + break;
181 case "1980년대": 187 case "1980년대":
182 return_year = 1980; 188 return_year = 1980;
183 break; 189 break;
...@@ -266,7 +272,6 @@ function get_info_using_country(country,search, res) { ...@@ -266,7 +272,6 @@ function get_info_using_country(country,search, res) {
266 }); 272 });
267 } 273 }
268 //전체 검색 274 //전체 검색
269 -// 미정 /미확인 이딴거 두개만 뜸
270 function get_info_all(searchAll, res) { 275 function get_info_all(searchAll, res) {
271 var en = encodeURI(searchAll); 276 var en = encodeURI(searchAll);
272 var api_url = 'https://openapi.naver.com/v1/search/movie.json?query='+en+'&display=100'; // json 결과 277 var api_url = 'https://openapi.naver.com/v1/search/movie.json?query='+en+'&display=100'; // json 결과
......
...@@ -7,10 +7,8 @@ ...@@ -7,10 +7,8 @@
7 </head> 7 </head>
8 <link rel="stylesheet" href="css/style.css"> 8 <link rel="stylesheet" href="css/style.css">
9 <link rel="stylesheet" href="css/bootstrap.min.css"> 9 <link rel="stylesheet" href="css/bootstrap.min.css">
10 -
11 <!-- 부가적인 테마 --> 10 <!-- 부가적인 테마 -->
12 <link rel="stylesheet" href="css/bootstrap-theme.min.css"> 11 <link rel="stylesheet" href="css/bootstrap-theme.min.css">
13 -
14 <!-- 합쳐지고 최소화된 최신 자바스크립트 --> 12 <!-- 합쳐지고 최소화된 최신 자바스크립트 -->
15 <script src="js/bootstrap.min.js"></script> 13 <script src="js/bootstrap.min.js"></script>
16 14
...@@ -19,28 +17,27 @@ $(function () { ...@@ -19,28 +17,27 @@ $(function () {
19 $('.click_genre').click(function () { 17 $('.click_genre').click(function () {
20 var str = $(this).text(); 18 var str = $(this).text();
21 $.ajax({ 19 $.ajax({
22 - type:"GET", 20 + type:"GET",
23 - url:"errata", 21 + url:"errata",
24 - data:{'query':$("#search_input").val()}, 22 + data:{'query':$("#search_input").val()},
25 - success:function(args2){ 23 + success:function(args2){
26 - 24 + if( args2.errata==""){
27 - if( args2.errata==""){ 25 + var search = $("#search_input").val();
28 - var search = $("#search_input").val(); 26 + }
29 - } 27 + else{
30 - else{ 28 + var search =args2.errata;
31 - var search =args2.errata; 29 + }
32 - } 30 + $.ajax({
33 - $.ajax({ 31 + type:"GET",
34 - type:"GET", 32 + url:"serach",
35 - url:"serach", 33 + data:{'genre':str, 'search':search},
36 - data:{'genre':str, 'search':search}, 34 + success:function(args){
37 - success:function(args){ 35 + $('#info').html(args);
38 - $('#info').html(args); 36 + //alert(args);
39 - //alert(args); 37 + alert(str + " 장르를 선택하셨습니다");
40 - alert(str + " 장르를 선택하셨습니다"); 38 + },
41 - }, 39 + });
42 - }); 40 + },
43 - },
44 }); 41 });
45 }) 42 })
46 }) 43 })
...@@ -49,29 +46,28 @@ $(function () { ...@@ -49,29 +46,28 @@ $(function () {
49 $('.click_year').click(function () { 46 $('.click_year').click(function () {
50 var str = $(this).text(); 47 var str = $(this).text();
51 $.ajax({ 48 $.ajax({
52 - type:"GET", 49 + type:"GET",
53 - url:"errata", 50 + url:"errata",
54 - data:{'query':$("#search_input").val()}, 51 + data:{'query':$("#search_input").val()},
55 - success:function(args2){ 52 + success:function(args2){
56 - 53 + if( args2.errata==""){
57 - if( args2.errata==""){ 54 + var search = $("#search_input").val();
58 - var search = $("#search_input").val(); 55 + }
59 - } 56 + else{
60 - else{ 57 + var search =args2.errata;
61 - var search =args2.errata; 58 + }
62 - } 59 + $.ajax({
63 - $.ajax({ 60 + type:"GET",
64 - type:"GET", 61 + url:"serach",
65 - url:"serach", 62 + data:{'year':str, 'search':search},
66 - data:{'year':str, 'search':search}, 63 + success:function(args){
67 - success:function(args){ 64 + $('#info').html(args);
68 - $('#info').html(args); 65 + //alert(args);
69 - //alert(args); 66 + alert(str + " 영화를 선택하셨습니다");
70 - alert(str + " 영화를 선택하셨습니다"); 67 + },
71 - },
72 - });
73 - },
74 }); 68 });
69 + },
70 + });
75 }) 71 })
76 }) 72 })
77 73
...@@ -80,29 +76,31 @@ $(function () { ...@@ -80,29 +76,31 @@ $(function () {
80 var str = $(this).text(); 76 var str = $(this).text();
81 str = str.slice(0,2); 77 str = str.slice(0,2);
82 $.ajax({ 78 $.ajax({
79 + type:"GET",
80 + url:"errata",
81 + data:{'query':$("#search_input").val()},
82 + success:function(args2){
83 + if( args2.errata==""){
84 + var search = $("#search_input").val();
85 + }
86 + else{
87 + var search =args2.errata;
88 + }
89 + $.ajax({
83 type:"GET", 90 type:"GET",
84 - url:"errata", 91 + url:"serach",
85 - data:{'query':$("#search_input").val()}, 92 + data:{'country':str , 'search':search},
86 - success:function(args2){ 93 + success:function(args){
87 - 94 + $('#info').html(args);
88 - if( args2.errata==""){ 95 + // alert(args);
89 - var search = $("#search_input").val(); 96 + if( str == "ET"){
90 - } 97 + str = "ETC";
91 - else{ 98 + }
92 - var search =args2.errata; 99 + alert(str + " 국가의 영화를 검색하셨습니다.");
93 - } 100 + },
94 - $.ajax({ 101 + });
95 - type:"GET", 102 + },
96 - url:"serach", 103 + });
97 - data:{'country':str , 'search':search},
98 - success:function(args){
99 - $('#info').html(args);
100 - //alert(args);
101 - alert(str + " 국가의 영화를 검색하셨습니다.");
102 - },
103 - });
104 - },
105 - });
106 }) 104 })
107 }) 105 })
108 106
...@@ -159,6 +157,8 @@ $(function () { ...@@ -159,6 +157,8 @@ $(function () {
159 <li> 157 <li>
160 Year 158 Year
161 <ul> 159 <ul>
160 + <li class = "click_year" >1960년대</li>
161 + <li class = "click_year" >1970년대</li>
162 <li class = "click_year" >1980년대</li> 162 <li class = "click_year" >1980년대</li>
163 <li class = "click_year" >1990년대</li> 163 <li class = "click_year" >1990년대</li>
164 <li class = "click_year" >2000년대</li> 164 <li class = "click_year" >2000년대</li>
...@@ -178,10 +178,8 @@ $(function () { ...@@ -178,10 +178,8 @@ $(function () {
178 <li class = "click_country" >ETC(기타)</li> 178 <li class = "click_country" >ETC(기타)</li>
179 </ul> 179 </ul>
180 </li> 180 </li>
181 -
182 <li class = "click_all" >All</li> 181 <li class = "click_all" >All</li>
183 </ul> 182 </ul>
184 -
185 <div id = info></div> 183 <div id = info></div>
186 </body> 184 </body>
187 </html> 185 </html>
......
1 + MIT License
2 +
3 + Copyright (c) Microsoft Corporation. All rights reserved.
4 +
5 + Permission is hereby granted, free of charge, to any person obtaining a copy
6 + of this software and associated documentation files (the "Software"), to deal
7 + in the Software without restriction, including without limitation the rights
8 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 + copies of the Software, and to permit persons to whom the Software is
10 + furnished to do so, subject to the following conditions:
11 +
12 + The above copyright notice and this permission notice shall be included in all
13 + copies or substantial portions of the Software.
14 +
15 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 + SOFTWARE
1 +# Installation
2 +> `npm install --save @types/node`
3 +
4 +# Summary
5 +This package contains type definitions for Node.js (http://nodejs.org/).
6 +
7 +# Details
8 +Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node
9 +
10 +Additional Details
11 + * Last updated: Tue, 05 Dec 2017 17:19:44 GMT
12 + * Dependencies: none
13 + * Global values: Buffer, NodeJS, SlowBuffer, Symbol, __dirname, __filename, clearImmediate, clearInterval, clearTimeout, console, exports, global, module, process, require, setImmediate, setInterval, setTimeout
14 +
15 +# Credits
16 +These definitions were written by Microsoft TypeScript <http://typescriptlang.org>, DefinitelyTyped <https://github.com/DefinitelyTyped/DefinitelyTyped>, Parambir Singh <https://github.com/parambirs>, Christian Vaagland Tellnes <https://github.com/tellnes>, Wilco Bakker <https://github.com/WilcoBakker>, Nicolas Voigt <https://github.com/octo-sniffle>, Chigozirim C. <https://github.com/smac89>, Flarna <https://github.com/Flarna>, Mariusz Wiktorczyk <https://github.com/mwiktorczyk>, wwwy3y3 <https://github.com/wwwy3y3>, Deividas Bakanas <https://github.com/DeividasBakanas>, Kelvin Jin <https://github.com/kjin>, Alvis HT Tang <https://github.com/alvis>, Oliver Joseph Ash <https://github.com/OliverJAsh>, Sebastian Silbermann <https://github.com/eps1lon>, Hannes Magnusson <https://github.com/Hannes-Magnusson-CK>.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
1 +{
2 + "_args": [
3 + [
4 + {
5 + "raw": "@types/node@*",
6 + "scope": "@types",
7 + "escapedName": "@types%2fnode",
8 + "name": "@types/node",
9 + "rawSpec": "*",
10 + "spec": "*",
11 + "type": "range"
12 + },
13 + "C:\\Users\\hyshs\\Desktop\\OSS_Project\\node_modules\\parse5"
14 + ]
15 + ],
16 + "_from": "@types/node@*",
17 + "_id": "@types/node@8.0.55",
18 + "_inCache": true,
19 + "_location": "/@types/node",
20 + "_npmOperationalInternal": {
21 + "host": "s3://npm-registry-packages",
22 + "tmp": "tmp/node-8.0.55.tgz_1512494414301_0.6088104459922761"
23 + },
24 + "_npmUser": {
25 + "name": "types",
26 + "email": "ts-npm-types@microsoft.com"
27 + },
28 + "_phantomChildren": {},
29 + "_requested": {
30 + "raw": "@types/node@*",
31 + "scope": "@types",
32 + "escapedName": "@types%2fnode",
33 + "name": "@types/node",
34 + "rawSpec": "*",
35 + "spec": "*",
36 + "type": "range"
37 + },
38 + "_requiredBy": [
39 + "/parse5"
40 + ],
41 + "_resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.55.tgz",
42 + "_shasum": "015966c0af809216b8a46cc527b5c211994d36f0",
43 + "_shrinkwrap": null,
44 + "_spec": "@types/node@*",
45 + "_where": "C:\\Users\\hyshs\\Desktop\\OSS_Project\\node_modules\\parse5",
46 + "contributors": [
47 + {
48 + "name": "Microsoft TypeScript",
49 + "url": "http://typescriptlang.org"
50 + },
51 + {
52 + "name": "DefinitelyTyped",
53 + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped"
54 + },
55 + {
56 + "name": "Parambir Singh",
57 + "url": "https://github.com/parambirs"
58 + },
59 + {
60 + "name": "Christian Vaagland Tellnes",
61 + "url": "https://github.com/tellnes"
62 + },
63 + {
64 + "name": "Wilco Bakker",
65 + "url": "https://github.com/WilcoBakker"
66 + },
67 + {
68 + "name": "Nicolas Voigt",
69 + "url": "https://github.com/octo-sniffle"
70 + },
71 + {
72 + "name": "Chigozirim C.",
73 + "url": "https://github.com/smac89"
74 + },
75 + {
76 + "name": "Flarna",
77 + "url": "https://github.com/Flarna"
78 + },
79 + {
80 + "name": "Mariusz Wiktorczyk",
81 + "url": "https://github.com/mwiktorczyk"
82 + },
83 + {
84 + "name": "wwwy3y3",
85 + "url": "https://github.com/wwwy3y3"
86 + },
87 + {
88 + "name": "Deividas Bakanas",
89 + "url": "https://github.com/DeividasBakanas"
90 + },
91 + {
92 + "name": "Kelvin Jin",
93 + "url": "https://github.com/kjin"
94 + },
95 + {
96 + "name": "Alvis HT Tang",
97 + "url": "https://github.com/alvis"
98 + },
99 + {
100 + "name": "Oliver Joseph Ash",
101 + "url": "https://github.com/OliverJAsh"
102 + },
103 + {
104 + "name": "Sebastian Silbermann",
105 + "url": "https://github.com/eps1lon"
106 + },
107 + {
108 + "name": "Hannes Magnusson",
109 + "url": "https://github.com/Hannes-Magnusson-CK"
110 + }
111 + ],
112 + "dependencies": {},
113 + "description": "TypeScript definitions for Node.js",
114 + "devDependencies": {},
115 + "directories": {},
116 + "dist": {
117 + "integrity": "sha512-K8w0FWNsIRcw615d/Et90wMRvLfg8XH1T77fC0xObbusE3+eXwnitdoF9j0CS9zBt8A57J/TKgRVe7RX9ZlT1g==",
118 + "shasum": "015966c0af809216b8a46cc527b5c211994d36f0",
119 + "tarball": "https://registry.npmjs.org/@types/node/-/node-8.0.55.tgz"
120 + },
121 + "license": "MIT",
122 + "main": "",
123 + "maintainers": [
124 + {
125 + "name": "types",
126 + "email": "ts-npm-types@microsoft.com"
127 + }
128 + ],
129 + "name": "@types/node",
130 + "optionalDependencies": {},
131 + "readme": "ERROR: No README data found!",
132 + "repository": {
133 + "type": "git",
134 + "url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git"
135 + },
136 + "scripts": {},
137 + "typeScriptVersion": "2.0",
138 + "typesPublisherContentHash": "2bcd1b1cf566409acd4703424129c1f9592163d76024af0c85c7de6862e93fb7",
139 + "version": "8.0.55"
140 +}
1 +#boolbase
2 +This very simple module provides two basic functions, one that always returns true (`trueFunc`) and one that always returns false (`falseFunc`).
3 +
4 +###WTF?
5 +
6 +By having only a single instance of these functions around, it's possible to do some nice optimizations. Eg. [`CSSselect`](https://github.com/fb55/CSSselect) uses these functions to determine whether a selector won't match any elements. If that's the case, the DOM doesn't even have to be touched.
7 +
8 +###And why is this a separate module?
9 +
10 +I'm trying to modularize `CSSselect` and most modules depend on these functions. IMHO, having a separate module is the easiest solution to this problem.
...\ No newline at end of file ...\ No newline at end of file
1 +module.exports = {
2 + trueFunc: function trueFunc(){
3 + return true;
4 + },
5 + falseFunc: function falseFunc(){
6 + return false;
7 + }
8 +};
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "_args": [
3 + [
4 + {
5 + "raw": "boolbase@~1.0.0",
6 + "scope": null,
7 + "escapedName": "boolbase",
8 + "name": "boolbase",
9 + "rawSpec": "~1.0.0",
10 + "spec": ">=1.0.0 <1.1.0",
11 + "type": "range"
12 + },
13 + "C:\\Users\\hyshs\\Desktop\\OSS_Project\\node_modules\\css-select"
14 + ]
15 + ],
16 + "_from": "boolbase@>=1.0.0 <1.1.0",
17 + "_id": "boolbase@1.0.0",
18 + "_inCache": true,
19 + "_location": "/boolbase",
20 + "_npmUser": {
21 + "name": "feedic",
22 + "email": "me@feedic.com"
23 + },
24 + "_npmVersion": "1.4.2",
25 + "_phantomChildren": {},
26 + "_requested": {
27 + "raw": "boolbase@~1.0.0",
28 + "scope": null,
29 + "escapedName": "boolbase",
30 + "name": "boolbase",
31 + "rawSpec": "~1.0.0",
32 + "spec": ">=1.0.0 <1.1.0",
33 + "type": "range"
34 + },
35 + "_requiredBy": [
36 + "/css-select",
37 + "/nth-check"
38 + ],
39 + "_resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
40 + "_shasum": "68dff5fbe60c51eb37725ea9e3ed310dcc1e776e",
41 + "_shrinkwrap": null,
42 + "_spec": "boolbase@~1.0.0",
43 + "_where": "C:\\Users\\hyshs\\Desktop\\OSS_Project\\node_modules\\css-select",
44 + "author": {
45 + "name": "Felix Boehm",
46 + "email": "me@feedic.com"
47 + },
48 + "bugs": {
49 + "url": "https://github.com/fb55/boolbase/issues"
50 + },
51 + "dependencies": {},
52 + "description": "two functions: One that returns true, one that returns false",
53 + "devDependencies": {},
54 + "directories": {},
55 + "dist": {
56 + "shasum": "68dff5fbe60c51eb37725ea9e3ed310dcc1e776e",
57 + "tarball": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz"
58 + },
59 + "homepage": "https://github.com/fb55/boolbase",
60 + "keywords": [
61 + "boolean",
62 + "function"
63 + ],
64 + "license": "ISC",
65 + "main": "index.js",
66 + "maintainers": [
67 + {
68 + "name": "feedic",
69 + "email": "me@feedic.com"
70 + }
71 + ],
72 + "name": "boolbase",
73 + "optionalDependencies": {},
74 + "readme": "ERROR: No README data found!",
75 + "repository": {
76 + "type": "git",
77 + "url": "git+https://github.com/fb55/boolbase.git"
78 + },
79 + "scripts": {
80 + "test": "echo \"Error: no test specified\" && exit 1"
81 + },
82 + "version": "1.0.0"
83 +}
This diff is collapsed. Click to expand it.
1 +MIT License
2 +
3 +Copyright (c) 2016 Matt Mueller
4 +
5 +Permission is hereby granted, free of charge, to any person obtaining a copy
6 +of this software and associated documentation files (the "Software"), to deal
7 +in the Software without restriction, including without limitation the rights
8 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 +copies of the Software, and to permit persons to whom the Software is
10 +furnished to do so, subject to the following conditions:
11 +
12 +The above copyright notice and this permission notice shall be included in all
13 +copies or substantial portions of the Software.
14 +
15 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 +SOFTWARE.
...\ No newline at end of file ...\ No newline at end of file
This diff is collapsed. Click to expand it.
1 +/**
2 + * Export cheerio (with )
3 + */
4 +
5 +exports = module.exports = require('./lib/cheerio');
6 +
7 +/*
8 + Export the version
9 +*/
10 +
11 +exports.version = require('./package.json').version;
This diff is collapsed. Click to expand it.
1 +var domEach = require('../utils').domEach,
2 + _ = {
3 + pick: require('lodash/pick'),
4 + };
5 +
6 +var toString = Object.prototype.toString;
7 +
8 +/**
9 + * Set / Get css.
10 + *
11 + * @param {String|Object} prop
12 + * @param {String} val
13 + * @return {self}
14 + * @api public
15 + */
16 +
17 +exports.css = function(prop, val) {
18 + if (arguments.length === 2 ||
19 + // When `prop` is a "plain" object
20 + (toString.call(prop) === '[object Object]')) {
21 + return domEach(this, function(idx, el) {
22 + setCss(el, prop, val, idx);
23 + });
24 + } else {
25 + return getCss(this[0], prop);
26 + }
27 +};
28 +
29 +/**
30 + * Set styles of all elements.
31 + *
32 + * @param {String|Object} prop
33 + * @param {String} val
34 + * @param {Number} idx - optional index within the selection
35 + * @return {self}
36 + * @api private
37 + */
38 +
39 +function setCss(el, prop, val, idx) {
40 + if ('string' == typeof prop) {
41 + var styles = getCss(el);
42 + if (typeof val === 'function') {
43 + val = val.call(el, idx, styles[prop]);
44 + }
45 +
46 + if (val === '') {
47 + delete styles[prop];
48 + } else if (val != null) {
49 + styles[prop] = val;
50 + }
51 +
52 + el.attribs.style = stringify(styles);
53 + } else if ('object' == typeof prop) {
54 + Object.keys(prop).forEach(function(k){
55 + setCss(el, k, prop[k]);
56 + });
57 + }
58 +}
59 +
60 +/**
61 + * Get parsed styles of the first element.
62 + *
63 + * @param {String} prop
64 + * @return {Object}
65 + * @api private
66 + */
67 +
68 +function getCss(el, prop) {
69 + var styles = parse(el.attribs.style);
70 + if (typeof prop === 'string') {
71 + return styles[prop];
72 + } else if (Array.isArray(prop)) {
73 + return _.pick(styles, prop);
74 + } else {
75 + return styles;
76 + }
77 +}
78 +
79 +/**
80 + * Stringify `obj` to styles.
81 + *
82 + * @param {Object} obj
83 + * @return {Object}
84 + * @api private
85 + */
86 +
87 +function stringify(obj) {
88 + return Object.keys(obj || {})
89 + .reduce(function(str, prop){
90 + return str += ''
91 + + (str ? ' ' : '')
92 + + prop
93 + + ': '
94 + + obj[prop]
95 + + ';';
96 + }, '');
97 +}
98 +
99 +/**
100 + * Parse `styles`.
101 + *
102 + * @param {String} styles
103 + * @return {Object}
104 + * @api private
105 + */
106 +
107 +function parse(styles) {
108 + styles = (styles || '').trim();
109 +
110 + if (!styles) return {};
111 +
112 + return styles
113 + .split(';')
114 + .reduce(function(obj, str){
115 + var n = str.indexOf(':');
116 + // skip if there is no :, or if it is the first/last character
117 + if (n < 1 || n === str.length-1) return obj;
118 + obj[str.slice(0,n).trim()] = str.slice(n+1).trim();
119 + return obj;
120 + }, {});
121 +}
1 +// https://github.com/jquery/jquery/blob/2.1.3/src/manipulation/var/rcheckableType.js
2 +// https://github.com/jquery/jquery/blob/2.1.3/src/serialize.js
3 +var submittableSelector = 'input,select,textarea,keygen',
4 + r20 = /%20/g,
5 + rCRLF = /\r?\n/g,
6 + _ = {
7 + map: require('lodash/map')
8 + };
9 +
10 +exports.serialize = function() {
11 + // Convert form elements into name/value objects
12 + var arr = this.serializeArray();
13 +
14 + // Serialize each element into a key/value string
15 + var retArr = _.map(arr, function(data) {
16 + return encodeURIComponent(data.name) + '=' + encodeURIComponent(data.value);
17 + });
18 +
19 + // Return the resulting serialization
20 + return retArr.join('&').replace(r20, '+');
21 +};
22 +
23 +exports.serializeArray = function() {
24 + // Resolve all form elements from either forms or collections of form elements
25 + var Cheerio = this.constructor;
26 + return this.map(function() {
27 + var elem = this;
28 + var $elem = Cheerio(elem);
29 + if (elem.name === 'form') {
30 + return $elem.find(submittableSelector).toArray();
31 + } else {
32 + return $elem.filter(submittableSelector).toArray();
33 + }
34 + }).filter(
35 + // Verify elements have a name (`attr.name`) and are not disabled (`:disabled`)
36 + '[name!=""]:not(:disabled)'
37 + // and cannot be clicked (`[type=submit]`) or are used in `x-www-form-urlencoded` (`[type=file]`)
38 + + ':not(:submit, :button, :image, :reset, :file)'
39 + // and are either checked/don't have a checkable state
40 + + ':matches([checked], :not(:checkbox, :radio))'
41 + // Convert each of the elements to its value(s)
42 + ).map(function(i, elem) {
43 + var $elem = Cheerio(elem);
44 + var name = $elem.attr('name');
45 + var value = $elem.val();
46 +
47 + // If there is no value set (e.g. `undefined`, `null`), then default value to empty
48 + if (value == null) {
49 + value = '';
50 + }
51 +
52 + // If we have an array of values (e.g. `<select multiple>`), return an array of key/value pairs
53 + if (Array.isArray(value)) {
54 + return _.map(value, function(val) {
55 + // We trim replace any line endings (e.g. `\r` or `\r\n` with `\r\n`) to guarantee consistency across platforms
56 + // These can occur inside of `<textarea>'s`
57 + return {name: name, value: val.replace( rCRLF, '\r\n' )};
58 + });
59 + // Otherwise (e.g. `<input type="text">`, return only one key/value pair
60 + } else {
61 + return {name: name, value: value.replace( rCRLF, '\r\n' )};
62 + }
63 + // Convert our result to an array
64 + }).get();
65 +};
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +/*
2 + Module dependencies
3 +*/
4 +
5 +var parse = require('./parse'),
6 + defaultOptions = require('./options').default,
7 + flattenOptions = require('./options').flatten,
8 + isHtml = require('./utils').isHtml,
9 + _ = {
10 + extend: require('lodash/assignIn'),
11 + bind: require('lodash/bind'),
12 + forEach: require('lodash/forEach'),
13 + defaults: require('lodash/defaults')
14 + };
15 +
16 +/*
17 + * The API
18 + */
19 +
20 +var api = [
21 + require('./api/attributes'),
22 + require('./api/traversing'),
23 + require('./api/manipulation'),
24 + require('./api/css'),
25 + require('./api/forms')
26 +];
27 +
28 +/*
29 + * Instance of cheerio
30 + */
31 +
32 +var Cheerio = module.exports = function(selector, context, root, options) {
33 + if (!(this instanceof Cheerio)) return new Cheerio(selector, context, root, options);
34 +
35 + this.options = _.defaults(flattenOptions(options), this.options, defaultOptions);
36 +
37 + // $(), $(null), $(undefined), $(false)
38 + if (!selector) return this;
39 +
40 + if (root) {
41 + if (typeof root === 'string') root = parse(root, this.options, false);
42 + this._root = Cheerio.call(this, root);
43 + }
44 +
45 + // $($)
46 + if (selector.cheerio) return selector;
47 +
48 + // $(dom)
49 + if (isNode(selector))
50 + selector = [selector];
51 +
52 + // $([dom])
53 + if (Array.isArray(selector)) {
54 + _.forEach(selector, _.bind(function(elem, idx) {
55 + this[idx] = elem;
56 + }, this));
57 + this.length = selector.length;
58 + return this;
59 + }
60 +
61 + // $(<html>)
62 + if (typeof selector === 'string' && isHtml(selector)) {
63 + return Cheerio.call(this, parse(selector, this.options, false).children);
64 + }
65 +
66 + // If we don't have a context, maybe we have a root, from loading
67 + if (!context) {
68 + context = this._root;
69 + } else if (typeof context === 'string') {
70 + if (isHtml(context)) {
71 + // $('li', '<ul>...</ul>')
72 + context = parse(context, this.options, false);
73 + context = Cheerio.call(this, context);
74 + } else {
75 + // $('li', 'ul')
76 + selector = [context, selector].join(' ');
77 + context = this._root;
78 + }
79 + // $('li', node), $('li', [nodes])
80 + } else if (!context.cheerio) {
81 + context = Cheerio.call(this, context);
82 + }
83 +
84 + // If we still don't have a context, return
85 + if (!context) return this;
86 +
87 + // #id, .class, tag
88 + return context.find(selector);
89 +};
90 +
91 +/**
92 + * Mix in `static`
93 + */
94 +
95 +_.extend(Cheerio, require('./static'));
96 +
97 +/*
98 + * Set a signature of the object
99 + */
100 +
101 +Cheerio.prototype.cheerio = '[cheerio object]';
102 +
103 +/*
104 + * Make cheerio an array-like object
105 + */
106 +
107 +Cheerio.prototype.length = 0;
108 +Cheerio.prototype.splice = Array.prototype.splice;
109 +
110 +/*
111 + * Make a cheerio object
112 + *
113 + * @api private
114 + */
115 +
116 +Cheerio.prototype._make = function(dom, context) {
117 + var cheerio = new this.constructor(dom, context, this._root, this.options);
118 + cheerio.prevObject = this;
119 + return cheerio;
120 +};
121 +
122 +/**
123 + * Turn a cheerio object into an array
124 + */
125 +
126 +Cheerio.prototype.toArray = function() {
127 + return this.get();
128 +};
129 +
130 +/**
131 + * Plug in the API
132 + */
133 +api.forEach(function(mod) {
134 + _.extend(Cheerio.prototype, mod);
135 +});
136 +
137 +var isNode = function(obj) {
138 + return obj.name || obj.type === 'text' || obj.type === 'comment';
139 +};
1 +var assign = require('lodash/assign');
2 +
3 +/*
4 + * Cheerio default options
5 + */
6 +
7 +exports.default = {
8 + withDomLvl1: true,
9 + normalizeWhitespace: false,
10 + xml: false,
11 + decodeEntities: true
12 +};
13 +
14 +exports.flatten = function(options) {
15 + return options && options.xml ? assign({xmlMode: true}, options.xml) : options;
16 +};
...\ No newline at end of file ...\ No newline at end of file
1 +/*
2 + Module Dependencies
3 +*/
4 +var htmlparser = require('htmlparser2'),
5 + parse5 = require('parse5');
6 +
7 +/*
8 + Parser
9 +*/
10 +exports = module.exports = function(content, options, isDocument) {
11 + var dom = exports.evaluate(content, options, isDocument),
12 + // Generic root element
13 + root = exports.evaluate('<root></root>', options, false)[0];
14 +
15 + root.type = 'root';
16 + root.parent = null;
17 +
18 + // Update the dom using the root
19 + exports.update(dom, root);
20 +
21 + return root;
22 +};
23 +
24 +function parseWithParse5 (content, isDocument) {
25 + var parse = isDocument ? parse5.parse : parse5.parseFragment,
26 + root = parse(content, { treeAdapter: parse5.treeAdapters.htmlparser2 });
27 +
28 + return root.children;
29 +}
30 +
31 +exports.evaluate = function(content, options, isDocument) {
32 + // options = options || $.fn.options;
33 +
34 + var dom;
35 +
36 + if (Buffer.isBuffer(content))
37 + content = content.toString();
38 +
39 + if (typeof content === 'string') {
40 + var useHtmlParser2 = options.xmlMode || options._useHtmlParser2;
41 +
42 + dom = useHtmlParser2 ? htmlparser.parseDOM(content, options) : parseWithParse5(content, isDocument);
43 + } else {
44 + dom = content;
45 + }
46 +
47 + return dom;
48 +};
49 +
50 +/*
51 + Update the dom structure, for one changed layer
52 +*/
53 +exports.update = function(arr, parent) {
54 + // normalize
55 + if (!Array.isArray(arr)) arr = [arr];
56 +
57 + // Update parent
58 + if (parent) {
59 + parent.children = arr;
60 + } else {
61 + parent = null;
62 + }
63 +
64 + // Update neighbors
65 + for (var i = 0; i < arr.length; i++) {
66 + var node = arr[i];
67 +
68 + // Cleanly remove existing nodes from their previous structures.
69 + var oldParent = node.parent || node.root,
70 + oldSiblings = oldParent && oldParent.children;
71 + if (oldSiblings && oldSiblings !== arr) {
72 + oldSiblings.splice(oldSiblings.indexOf(node), 1);
73 + if (node.prev) {
74 + node.prev.next = node.next;
75 + }
76 + if (node.next) {
77 + node.next.prev = node.prev;
78 + }
79 + }
80 +
81 + if (parent) {
82 + node.prev = arr[i - 1] || null;
83 + node.next = arr[i + 1] || null;
84 + } else {
85 + node.prev = node.next = null;
86 + }
87 +
88 + if (parent && parent.type === 'root') {
89 + node.root = parent;
90 + node.parent = null;
91 + } else {
92 + node.root = null;
93 + node.parent = parent;
94 + }
95 + }
96 +
97 + return parent;
98 +};
99 +
100 +// module.exports = $.extend(exports);
1 +/**
2 + * Module dependencies
3 + */
4 +
5 +var serialize = require('dom-serializer'),
6 + defaultOptions = require('./options').default,
7 + flattenOptions = require('./options').flatten,
8 + select = require('css-select'),
9 + parse = require('./parse'),
10 + _ = {
11 + merge: require('lodash/merge'),
12 + defaults: require('lodash/defaults')
13 + };
14 +
15 +/**
16 + * $.load(str)
17 + */
18 +
19 +exports.load = function(content, options, isDocument) {
20 + var Cheerio = require('./cheerio');
21 +
22 + options = _.defaults(flattenOptions(options || {}), defaultOptions);
23 +
24 + if (isDocument === void 0)
25 + isDocument = true;
26 +
27 + var root = parse(content, options, isDocument);
28 +
29 + var initialize = function(selector, context, r, opts) {
30 + if (!(this instanceof initialize)) {
31 + return new initialize(selector, context, r, opts);
32 + }
33 + opts = _.defaults(opts || {}, options);
34 + return Cheerio.call(this, selector, context, r || root, opts);
35 + };
36 +
37 + // Ensure that selections created by the "loaded" `initialize` function are
38 + // true Cheerio instances.
39 + initialize.prototype = Object.create(Cheerio.prototype);
40 + initialize.prototype.constructor = initialize;
41 +
42 + // Mimic jQuery's prototype alias for plugin authors.
43 + initialize.fn = initialize.prototype;
44 +
45 + // Keep a reference to the top-level scope so we can chain methods that implicitly
46 + // resolve selectors; e.g. $("<span>").(".bar"), which otherwise loses ._root
47 + initialize.prototype._originalRoot = root;
48 +
49 + // Add in the static methods
50 + _.merge(initialize, exports);
51 +
52 + // Add in the root
53 + initialize._root = root;
54 + // store options
55 + initialize._options = options;
56 +
57 + return initialize;
58 +};
59 +
60 +/*
61 +* Helper function
62 +*/
63 +
64 +function render(that, dom, options) {
65 + if (!dom) {
66 + if (that._root && that._root.children) {
67 + dom = that._root.children;
68 + } else {
69 + return '';
70 + }
71 + } else if (typeof dom === 'string') {
72 + dom = select(dom, that._root, options);
73 + }
74 +
75 + return serialize(dom, options);
76 +}
77 +
78 +/**
79 + * $.html([selector | dom], [options])
80 + */
81 +
82 +exports.html = function(dom, options) {
83 + // be flexible about parameters, sometimes we call html(),
84 + // with options as only parameter
85 + // check dom argument for dom element specific properties
86 + // assume there is no 'length' or 'type' properties in the options object
87 + if (Object.prototype.toString.call(dom) === '[object Object]' && !options && !('length' in dom) && !('type' in dom))
88 + {
89 + options = dom;
90 + dom = undefined;
91 + }
92 +
93 + // sometimes $.html() used without preloading html
94 + // so fallback non existing options to the default ones
95 + options = _.defaults(flattenOptions(options || {}), this._options, defaultOptions);
96 +
97 + return render(this, dom, options);
98 +};
99 +
100 +/**
101 + * $.xml([selector | dom])
102 + */
103 +
104 +exports.xml = function(dom) {
105 + var options = _.defaults({xml: true}, this._options);
106 +
107 + return render(this, dom, options);
108 +};
109 +
110 +/**
111 + * $.text(dom)
112 + */
113 +
114 +exports.text = function(elems) {
115 + if (!elems) {
116 + elems = this.root();
117 + }
118 +
119 + var ret = '',
120 + len = elems.length,
121 + elem;
122 +
123 + for (var i = 0; i < len; i++) {
124 + elem = elems[i];
125 + if (elem.type === 'text') ret += elem.data;
126 + else if (elem.children && elem.type !== 'comment' && elem.tagName !== 'script' && elem.tagName !== 'style') {
127 + ret += exports.text(elem.children);
128 + }
129 + }
130 +
131 + return ret;
132 +};
133 +
134 +/**
135 + * $.parseHTML(data [, context ] [, keepScripts ])
136 + * Parses a string into an array of DOM nodes. The `context` argument has no
137 + * meaning for Cheerio, but it is maintained for API compatibility with jQuery.
138 + */
139 +exports.parseHTML = function(data, context, keepScripts) {
140 + var parsed;
141 +
142 + if (!data || typeof data !== 'string') {
143 + return null;
144 + }
145 +
146 + if (typeof context === 'boolean') {
147 + keepScripts = context;
148 + }
149 +
150 + parsed = this.load(data, defaultOptions, false);
151 + if (!keepScripts) {
152 + parsed('script').remove();
153 + }
154 +
155 + // The `children` array is used by Cheerio internally to group elements that
156 + // share the same parents. When nodes created through `parseHTML` are
157 + // inserted into previously-existing DOM structures, they will be removed
158 + // from the `children` array. The results of `parseHTML` should remain
159 + // constant across these operations, so a shallow copy should be returned.
160 + return parsed.root()[0].children.slice();
161 +};
162 +
163 +/**
164 + * $.root()
165 + */
166 +exports.root = function() {
167 + return this(this._root);
168 +};
169 +
170 +/**
171 + * $.contains()
172 + */
173 +exports.contains = function(container, contained) {
174 +
175 + // According to the jQuery API, an element does not "contain" itself
176 + if (contained === container) {
177 + return false;
178 + }
179 +
180 + // Step up the descendants, stopping when the root element is reached
181 + // (signaled by `.parent` returning a reference to the same object)
182 + while (contained && contained !== contained.parent) {
183 + contained = contained.parent;
184 + if (contained === container) {
185 + return true;
186 + }
187 + }
188 +
189 + return false;
190 +};
191 +
192 +/**
193 + * $.merge()
194 + */
195 +
196 +exports.merge = function(arr1, arr2) {
197 + if(!(isArrayLike(arr1) && isArrayLike(arr2))){
198 + return;
199 + }
200 + var newLength = arr1.length + arr2.length;
201 + var i = 0;
202 + while(i < arr2.length){
203 + arr1[i + arr1.length] = arr2[i];
204 + i++;
205 + }
206 + arr1.length = newLength;
207 + return arr1;
208 +};
209 +
210 +function isArrayLike(item){
211 + if(Array.isArray(item)){
212 + return true;
213 + }
214 + if(typeof item !== 'object'){
215 + return false;
216 + }
217 + if(!item.hasOwnProperty('length')){
218 + return false;
219 + }
220 + if(typeof item.length !== 'number') {
221 + return false;
222 + }
223 + if(item.length < 0){
224 + return false;
225 + }
226 + var i = 0;
227 + while(i < item.length){
228 + if(!(i in item)){
229 + return false;
230 + }
231 + i++;
232 + }
233 + return true;
234 +}
1 +var parse = require('./parse'),
2 + render = require('dom-serializer'),
3 + assign = require('lodash/assign');
4 +
5 +/**
6 + * HTML Tags
7 + */
8 +
9 +var tags = { tag: true, script: true, style: true };
10 +
11 +/**
12 + * Check if the DOM element is a tag
13 + *
14 + * isTag(type) includes <script> and <style> tags
15 + */
16 +
17 +exports.isTag = function(type) {
18 + if (type.type) type = type.type;
19 + return tags[type] || false;
20 +};
21 +
22 +/**
23 + * Convert a string to camel case notation.
24 + * @param {String} str String to be converted.
25 + * @return {String} String in camel case notation.
26 + */
27 +
28 +exports.camelCase = function(str) {
29 + return str.replace(/[_.-](\w|$)/g, function(_, x) {
30 + return x.toUpperCase();
31 + });
32 +};
33 +
34 +/**
35 + * Convert a string from camel case to "CSS case", where word boundaries are
36 + * described by hyphens ("-") and all characters are lower-case.
37 + * @param {String} str String to be converted.
38 + * @return {string} String in "CSS case".
39 + */
40 +exports.cssCase = function(str) {
41 + return str.replace(/[A-Z]/g, '-$&').toLowerCase();
42 +};
43 +
44 +/**
45 + * Iterate over each DOM element without creating intermediary Cheerio instances.
46 + *
47 + * This is indented for use internally to avoid otherwise unnecessary memory pressure introduced
48 + * by _make.
49 + */
50 +
51 +exports.domEach = function(cheerio, fn) {
52 + var i = 0, len = cheerio.length;
53 + while (i < len && fn.call(cheerio, i, cheerio[i]) !== false) ++i;
54 + return cheerio;
55 +};
56 +
57 +/**
58 + * Create a deep copy of the given DOM structure by first rendering it to a
59 + * string and then parsing the resultant markup.
60 + *
61 + * @argument {Object} dom - The htmlparser2-compliant DOM structure
62 + * @argument {Object} options - The parsing/rendering options
63 + */
64 +exports.cloneDom = function(dom, options) {
65 + options = assign({}, options, { _useHtmlParser2: true });
66 +
67 + return parse(render(dom, options), options, false).children;
68 +};
69 +
70 +/*
71 + * A simple way to check for HTML strings or ID strings
72 + */
73 +
74 +var quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/;
75 +
76 +/*
77 + * Check if string is HTML
78 + */
79 +exports.isHtml = function(str) {
80 + // Faster than running regex, if str starts with `<` and ends with `>`, assume it's HTML
81 + if (str.charAt(0) === '<' && str.charAt(str.length - 1) === '>' && str.length >= 3) return true;
82 +
83 + // Run the regex
84 + var match = quickExpr.exec(str);
85 + return !!(match && match[1]);
86 +};
1 +{
2 + "_args": [
3 + [
4 + {
5 + "raw": "cheerio",
6 + "scope": null,
7 + "escapedName": "cheerio",
8 + "name": "cheerio",
9 + "rawSpec": "",
10 + "spec": "latest",
11 + "type": "tag"
12 + },
13 + "C:\\Users\\hyshs\\Desktop\\OSS_Project"
14 + ]
15 + ],
16 + "_from": "cheerio@latest",
17 + "_id": "cheerio@1.0.0-rc.2",
18 + "_inCache": true,
19 + "_location": "/cheerio",
20 + "_nodeVersion": "6.10.3",
21 + "_npmOperationalInternal": {
22 + "host": "s3://npm-registry-packages",
23 + "tmp": "tmp/cheerio-1.0.0-rc.2.tgz_1499017014157_0.4666579710319638"
24 + },
25 + "_npmUser": {
26 + "name": "jugglinmike",
27 + "email": "mike@mikepennisi.com"
28 + },
29 + "_npmVersion": "3.10.10",
30 + "_phantomChildren": {},
31 + "_requested": {
32 + "raw": "cheerio",
33 + "scope": null,
34 + "escapedName": "cheerio",
35 + "name": "cheerio",
36 + "rawSpec": "",
37 + "spec": "latest",
38 + "type": "tag"
39 + },
40 + "_requiredBy": [
41 + "#USER",
42 + "/"
43 + ],
44 + "_resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.2.tgz",
45 + "_shasum": "4b9f53a81b27e4d5dac31c0ffd0cfa03cc6830db",
46 + "_shrinkwrap": null,
47 + "_spec": "cheerio",
48 + "_where": "C:\\Users\\hyshs\\Desktop\\OSS_Project",
49 + "author": {
50 + "name": "Matt Mueller",
51 + "email": "mattmuelle@gmail.com",
52 + "url": "mat.io"
53 + },
54 + "bugs": {
55 + "url": "https://github.com/cheeriojs/cheerio/issues"
56 + },
57 + "dependencies": {
58 + "css-select": "~1.2.0",
59 + "dom-serializer": "~0.1.0",
60 + "entities": "~1.1.1",
61 + "htmlparser2": "^3.9.1",
62 + "lodash": "^4.15.0",
63 + "parse5": "^3.0.1"
64 + },
65 + "description": "Tiny, fast, and elegant implementation of core jQuery designed specifically for the server",
66 + "devDependencies": {
67 + "benchmark": "^2.1.0",
68 + "coveralls": "^2.11.9",
69 + "expect.js": "~0.3.1",
70 + "istanbul": "^0.4.3",
71 + "jquery": "^3.0.0",
72 + "jsdom": "^9.2.1",
73 + "jshint": "^2.9.2",
74 + "mocha": "^3.1.2",
75 + "xyz": "~1.1.0"
76 + },
77 + "directories": {},
78 + "dist": {
79 + "shasum": "4b9f53a81b27e4d5dac31c0ffd0cfa03cc6830db",
80 + "tarball": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.2.tgz"
81 + },
82 + "engines": {
83 + "node": ">= 0.6"
84 + },
85 + "files": [
86 + "index.js",
87 + "lib"
88 + ],
89 + "gitHead": "48eae25c93702a29b8cd0d09c4a2dce2f912d1f4",
90 + "homepage": "https://github.com/cheeriojs/cheerio#readme",
91 + "keywords": [
92 + "htmlparser",
93 + "jquery",
94 + "selector",
95 + "scraper",
96 + "parser",
97 + "html"
98 + ],
99 + "license": "MIT",
100 + "main": "./index.js",
101 + "maintainers": [
102 + {
103 + "name": "mattmueller",
104 + "email": "mattmuelle@gmail.com"
105 + },
106 + {
107 + "name": "davidchambers",
108 + "email": "dc@davidchambers.me"
109 + },
110 + {
111 + "name": "jugglinmike",
112 + "email": "mike@mikepennisi.com"
113 + },
114 + {
115 + "name": "feedic",
116 + "email": "me@feedic.com"
117 + }
118 + ],
119 + "name": "cheerio",
120 + "optionalDependencies": {},
121 + "readme": "ERROR: No README data found!",
122 + "repository": {
123 + "type": "git",
124 + "url": "git://github.com/cheeriojs/cheerio.git"
125 + },
126 + "scripts": {
127 + "test": "make test"
128 + },
129 + "version": "1.0.0-rc.2"
130 +}
1 +Copyright (c) Felix Böhm
2 +All rights reserved.
3 +
4 +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5 +
6 +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7 +
8 +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 +
10 +THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
11 +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1 +# css-select [![NPM version](http://img.shields.io/npm/v/css-select.svg)](https://npmjs.org/package/css-select) [![Build Status](https://travis-ci.org/fb55/css-select.svg?branch=master)](http://travis-ci.org/fb55/css-select) [![Downloads](https://img.shields.io/npm/dm/css-select.svg)](https://npmjs.org/package/css-select) [![Coverage](https://coveralls.io/repos/fb55/css-select/badge.svg?branch=master)](https://coveralls.io/r/fb55/css-select)
2 +
3 +a CSS selector compiler/engine
4 +
5 +## What?
6 +
7 +css-select turns CSS selectors into functions that tests if elements match them. When searching for elements, testing is executed "from the top", similar to how browsers execute CSS selectors.
8 +
9 +In its default configuration, css-select queries the DOM structure of the [`domhandler`](https://github.com/fb55/domhandler) module (also known as htmlparser2 DOM).
10 +
11 +__Features:__
12 +
13 +- Full implementation of CSS3 selectors
14 +- Partial implementation of jQuery/Sizzle extensions
15 +- Very high test coverage
16 +- Pretty good performance
17 +
18 +## Why?
19 +
20 +The traditional approach of executing CSS selectors, named left-to-right execution, is to execute every component of the selector in order, from left to right _(duh)_. The execution of the selector `a b` for example will first query for `a` elements, then search these for `b` elements. (That's the approach of eg. [`Sizzle`](https://github.com/jquery/sizzle), [`nwmatcher`](https://github.com/dperini/nwmatcher/) and [`qwery`](https://github.com/ded/qwery).)
21 +
22 +While this works, it has some downsides: Children of `a`s will be checked multiple times; first, to check if they are also `a`s, then, for every superior `a` once, if they are `b`s. Using [Big O notation](http://en.wikipedia.org/wiki/Big_O_notation), that would be `O(n^(k+1))`, where `k` is the number of descendant selectors (that's the space in the example above).
23 +
24 +The far more efficient approach is to first look for `b` elements, then check if they have superior `a` elements: Using big O notation again, that would be `O(n)`. That's called right-to-left execution.
25 +
26 +And that's what css-select does – and why it's quite performant.
27 +
28 +## How does it work?
29 +
30 +By building a stack of functions.
31 +
32 +_Wait, what?_
33 +
34 +Okay, so let's suppose we want to compile the selector `a b` again, for right-to-left execution. We start by _parsing_ the selector, which means we turn the selector into an array of the building-blocks of the selector, so we can distinguish them easily. That's what the [`css-what`](https://github.com/fb55/css-what) module is for, if you want to have a look.
35 +
36 +Anyway, after parsing, we end up with an array like this one:
37 +
38 +```js
39 +[
40 + { type: 'tag', name: 'a' },
41 + { type: 'descendant' },
42 + { type: 'tag', name: 'b' }
43 +]
44 +```
45 +
46 +Actually, this array is wrapped in another array, but that's another story (involving commas in selectors).
47 +
48 +Now that we know the meaning of every part of the selector, we can compile it. That's where it becomes interesting.
49 +
50 +The basic idea is to turn every part of the selector into a function, which takes an element as its only argument. The function checks whether a passed element matches its part of the selector: If it does, the element is passed to the next turned-into-a-function part of the selector, which does the same. If an element is accepted by all parts of the selector, it _matches_ the selector and double rainbow ALL THE WAY.
51 +
52 +As said before, we want to do right-to-left execution with all the big O improvements nonsense, so elements are passed from the rightmost part of the selector (`b` in our example) to the leftmost (~~which would be `c`~~ of course `a`).
53 +
54 +_//TODO: More in-depth description. Implementation details. Build a spaceship._
55 +
56 +## API
57 +
58 +```js
59 +var CSSselect = require("css-select");
60 +```
61 +
62 +#### `CSSselect(query, elems, options)`
63 +
64 +Queries `elems`, returns an array containing all matches.
65 +
66 +- `query` can be either a CSS selector or a function.
67 +- `elems` can be either an array of elements, or a single element. If it is an element, its children will be queried.
68 +- `options` is described below.
69 +
70 +Aliases: `CSSselect.selectAll(query, elems)`, `CSSselect.iterate(query, elems)`.
71 +
72 +#### `CSSselect.compile(query)`
73 +
74 +Compiles the query, returns a function.
75 +
76 +#### `CSSselect.is(elem, query, options)`
77 +
78 +Tests whether or not an element is matched by `query`. `query` can be either a CSS selector or a function.
79 +
80 +#### `CSSselect.selectOne(query, elems, options)`
81 +
82 +Arguments are the same as for `CSSselect(query, elems)`. Only returns the first match, or `null` if there was no match.
83 +
84 +### Options
85 +
86 +- `xmlMode`: When enabled, tag names will be case-sensitive. Default: `false`.
87 +- `strict`: Limits the module to only use CSS3 selectors. Default: `false`.
88 +- `rootFunc`: The last function in the stack, will be called with the last element that's looked at. Should return `true`.
89 +
90 +## Supported selectors
91 +
92 +_As defined by CSS 4 and / or jQuery._
93 +
94 +* Universal (`*`)
95 +* Tag (`<tagname>`)
96 +* Descendant (` `)
97 +* Child (`>`)
98 +* Parent (`<`) *
99 +* Sibling (`+`)
100 +* Adjacent (`~`)
101 +* Attribute (`[attr=foo]`), with supported comparisons:
102 + * `[attr]` (existential)
103 + * `=`
104 + * `~=`
105 + * `|=`
106 + * `*=`
107 + * `^=`
108 + * `$=`
109 + * `!=` *
110 + * Also, `i` can be added after the comparison to make the comparison case-insensitive (eg. `[attr=foo i]`) *
111 +* Pseudos:
112 + * `:not`
113 + * `:contains` *
114 + * `:icontains` * (case-insensitive version of `:contains`)
115 + * `:has` *
116 + * `:root`
117 + * `:empty`
118 + * `:parent` *
119 + * `:[first|last]-child[-of-type]`
120 + * `:only-of-type`, `:only-child`
121 + * `:nth-[last-]child[-of-type]`
122 + * `:link`, `:visited` (the latter doesn't match any elements)
123 + * `:selected` *, `:checked`
124 + * `:enabled`, `:disabled`
125 + * `:required`, `:optional`
126 + * `:header`, `:button`, `:input`, `:text`, `:checkbox`, `:file`, `:password`, `:reset`, `:radio` etc. *
127 + * `:matches` *
128 +
129 +__*__: Not part of CSS3
130 +
131 +---
132 +
133 +License: BSD-like
1 +"use strict";
2 +
3 +module.exports = CSSselect;
4 +
5 +var Pseudos = require("./lib/pseudos.js"),
6 + DomUtils = require("domutils"),
7 + findOne = DomUtils.findOne,
8 + findAll = DomUtils.findAll,
9 + getChildren = DomUtils.getChildren,
10 + removeSubsets = DomUtils.removeSubsets,
11 + falseFunc = require("boolbase").falseFunc,
12 + compile = require("./lib/compile.js"),
13 + compileUnsafe = compile.compileUnsafe,
14 + compileToken = compile.compileToken;
15 +
16 +function getSelectorFunc(searchFunc){
17 + return function select(query, elems, options){
18 + if(typeof query !== "function") query = compileUnsafe(query, options, elems);
19 + if(!Array.isArray(elems)) elems = getChildren(elems);
20 + else elems = removeSubsets(elems);
21 + return searchFunc(query, elems);
22 + };
23 +}
24 +
25 +var selectAll = getSelectorFunc(function selectAll(query, elems){
26 + return (query === falseFunc || !elems || elems.length === 0) ? [] : findAll(query, elems);
27 +});
28 +
29 +var selectOne = getSelectorFunc(function selectOne(query, elems){
30 + return (query === falseFunc || !elems || elems.length === 0) ? null : findOne(query, elems);
31 +});
32 +
33 +function is(elem, query, options){
34 + return (typeof query === "function" ? query : compile(query, options))(elem);
35 +}
36 +
37 +/*
38 + the exported interface
39 +*/
40 +function CSSselect(query, elems, options){
41 + return selectAll(query, elems, options);
42 +}
43 +
44 +CSSselect.compile = compile;
45 +CSSselect.filters = Pseudos.filters;
46 +CSSselect.pseudos = Pseudos.pseudos;
47 +
48 +CSSselect.selectAll = selectAll;
49 +CSSselect.selectOne = selectOne;
50 +
51 +CSSselect.is = is;
52 +
53 +//legacy methods (might be removed)
54 +CSSselect.parse = compile;
55 +CSSselect.iterate = selectAll;
56 +
57 +//hooks
58 +CSSselect._compileUnsafe = compileUnsafe;
59 +CSSselect._compileToken = compileToken;
1 +var DomUtils = require("domutils"),
2 + hasAttrib = DomUtils.hasAttrib,
3 + getAttributeValue = DomUtils.getAttributeValue,
4 + falseFunc = require("boolbase").falseFunc;
5 +
6 +//https://github.com/slevithan/XRegExp/blob/master/src/xregexp.js#L469
7 +var reChars = /[-[\]{}()*+?.,\\^$|#\s]/g;
8 +
9 +/*
10 + attribute selectors
11 +*/
12 +
13 +var attributeRules = {
14 + __proto__: null,
15 + equals: function(next, data){
16 + var name = data.name,
17 + value = data.value;
18 +
19 + if(data.ignoreCase){
20 + value = value.toLowerCase();
21 +
22 + return function equalsIC(elem){
23 + var attr = getAttributeValue(elem, name);
24 + return attr != null && attr.toLowerCase() === value && next(elem);
25 + };
26 + }
27 +
28 + return function equals(elem){
29 + return getAttributeValue(elem, name) === value && next(elem);
30 + };
31 + },
32 + hyphen: function(next, data){
33 + var name = data.name,
34 + value = data.value,
35 + len = value.length;
36 +
37 + if(data.ignoreCase){
38 + value = value.toLowerCase();
39 +
40 + return function hyphenIC(elem){
41 + var attr = getAttributeValue(elem, name);
42 + return attr != null &&
43 + (attr.length === len || attr.charAt(len) === "-") &&
44 + attr.substr(0, len).toLowerCase() === value &&
45 + next(elem);
46 + };
47 + }
48 +
49 + return function hyphen(elem){
50 + var attr = getAttributeValue(elem, name);
51 + return attr != null &&
52 + attr.substr(0, len) === value &&
53 + (attr.length === len || attr.charAt(len) === "-") &&
54 + next(elem);
55 + };
56 + },
57 + element: function(next, data){
58 + var name = data.name,
59 + value = data.value;
60 +
61 + if(/\s/.test(value)){
62 + return falseFunc;
63 + }
64 +
65 + value = value.replace(reChars, "\\$&");
66 +
67 + var pattern = "(?:^|\\s)" + value + "(?:$|\\s)",
68 + flags = data.ignoreCase ? "i" : "",
69 + regex = new RegExp(pattern, flags);
70 +
71 + return function element(elem){
72 + var attr = getAttributeValue(elem, name);
73 + return attr != null && regex.test(attr) && next(elem);
74 + };
75 + },
76 + exists: function(next, data){
77 + var name = data.name;
78 + return function exists(elem){
79 + return hasAttrib(elem, name) && next(elem);
80 + };
81 + },
82 + start: function(next, data){
83 + var name = data.name,
84 + value = data.value,
85 + len = value.length;
86 +
87 + if(len === 0){
88 + return falseFunc;
89 + }
90 +
91 + if(data.ignoreCase){
92 + value = value.toLowerCase();
93 +
94 + return function startIC(elem){
95 + var attr = getAttributeValue(elem, name);
96 + return attr != null && attr.substr(0, len).toLowerCase() === value && next(elem);
97 + };
98 + }
99 +
100 + return function start(elem){
101 + var attr = getAttributeValue(elem, name);
102 + return attr != null && attr.substr(0, len) === value && next(elem);
103 + };
104 + },
105 + end: function(next, data){
106 + var name = data.name,
107 + value = data.value,
108 + len = -value.length;
109 +
110 + if(len === 0){
111 + return falseFunc;
112 + }
113 +
114 + if(data.ignoreCase){
115 + value = value.toLowerCase();
116 +
117 + return function endIC(elem){
118 + var attr = getAttributeValue(elem, name);
119 + return attr != null && attr.substr(len).toLowerCase() === value && next(elem);
120 + };
121 + }
122 +
123 + return function end(elem){
124 + var attr = getAttributeValue(elem, name);
125 + return attr != null && attr.substr(len) === value && next(elem);
126 + };
127 + },
128 + any: function(next, data){
129 + var name = data.name,
130 + value = data.value;
131 +
132 + if(value === ""){
133 + return falseFunc;
134 + }
135 +
136 + if(data.ignoreCase){
137 + var regex = new RegExp(value.replace(reChars, "\\$&"), "i");
138 +
139 + return function anyIC(elem){
140 + var attr = getAttributeValue(elem, name);
141 + return attr != null && regex.test(attr) && next(elem);
142 + };
143 + }
144 +
145 + return function any(elem){
146 + var attr = getAttributeValue(elem, name);
147 + return attr != null && attr.indexOf(value) >= 0 && next(elem);
148 + };
149 + },
150 + not: function(next, data){
151 + var name = data.name,
152 + value = data.value;
153 +
154 + if(value === ""){
155 + return function notEmpty(elem){
156 + return !!getAttributeValue(elem, name) && next(elem);
157 + };
158 + } else if(data.ignoreCase){
159 + value = value.toLowerCase();
160 +
161 + return function notIC(elem){
162 + var attr = getAttributeValue(elem, name);
163 + return attr != null && attr.toLowerCase() !== value && next(elem);
164 + };
165 + }
166 +
167 + return function not(elem){
168 + return getAttributeValue(elem, name) !== value && next(elem);
169 + };
170 + }
171 +};
172 +
173 +module.exports = {
174 + compile: function(next, data, options){
175 + if(options && options.strict && (
176 + data.ignoreCase || data.action === "not"
177 + )) throw SyntaxError("Unsupported attribute selector");
178 + return attributeRules[data.action](next, data);
179 + },
180 + rules: attributeRules
181 +};
1 +/*
2 + compiles a selector to an executable function
3 +*/
4 +
5 +module.exports = compile;
6 +module.exports.compileUnsafe = compileUnsafe;
7 +module.exports.compileToken = compileToken;
8 +
9 +var parse = require("css-what"),
10 + DomUtils = require("domutils"),
11 + isTag = DomUtils.isTag,
12 + Rules = require("./general.js"),
13 + sortRules = require("./sort.js"),
14 + BaseFuncs = require("boolbase"),
15 + trueFunc = BaseFuncs.trueFunc,
16 + falseFunc = BaseFuncs.falseFunc,
17 + procedure = require("./procedure.json");
18 +
19 +function compile(selector, options, context){
20 + var next = compileUnsafe(selector, options, context);
21 + return wrap(next);
22 +}
23 +
24 +function wrap(next){
25 + return function base(elem){
26 + return isTag(elem) && next(elem);
27 + };
28 +}
29 +
30 +function compileUnsafe(selector, options, context){
31 + var token = parse(selector, options);
32 + return compileToken(token, options, context);
33 +}
34 +
35 +function includesScopePseudo(t){
36 + return t.type === "pseudo" && (
37 + t.name === "scope" || (
38 + Array.isArray(t.data) &&
39 + t.data.some(function(data){
40 + return data.some(includesScopePseudo);
41 + })
42 + )
43 + );
44 +}
45 +
46 +var DESCENDANT_TOKEN = {type: "descendant"},
47 + SCOPE_TOKEN = {type: "pseudo", name: "scope"},
48 + PLACEHOLDER_ELEMENT = {},
49 + getParent = DomUtils.getParent;
50 +
51 +//CSS 4 Spec (Draft): 3.3.1. Absolutizing a Scope-relative Selector
52 +//http://www.w3.org/TR/selectors4/#absolutizing
53 +function absolutize(token, context){
54 + //TODO better check if context is document
55 + var hasContext = !!context && !!context.length && context.every(function(e){
56 + return e === PLACEHOLDER_ELEMENT || !!getParent(e);
57 + });
58 +
59 +
60 + token.forEach(function(t){
61 + if(t.length > 0 && isTraversal(t[0]) && t[0].type !== "descendant"){
62 + //don't return in else branch
63 + } else if(hasContext && !includesScopePseudo(t)){
64 + t.unshift(DESCENDANT_TOKEN);
65 + } else {
66 + return;
67 + }
68 +
69 + t.unshift(SCOPE_TOKEN);
70 + });
71 +}
72 +
73 +function compileToken(token, options, context){
74 + token = token.filter(function(t){ return t.length > 0; });
75 +
76 + token.forEach(sortRules);
77 +
78 + var isArrayContext = Array.isArray(context);
79 +
80 + context = (options && options.context) || context;
81 +
82 + if(context && !isArrayContext) context = [context];
83 +
84 + absolutize(token, context);
85 +
86 + return token
87 + .map(function(rules){ return compileRules(rules, options, context, isArrayContext); })
88 + .reduce(reduceRules, falseFunc);
89 +}
90 +
91 +function isTraversal(t){
92 + return procedure[t.type] < 0;
93 +}
94 +
95 +function compileRules(rules, options, context, isArrayContext){
96 + var acceptSelf = (isArrayContext && rules[0].name === "scope" && rules[1].type === "descendant");
97 + return rules.reduce(function(func, rule, index){
98 + if(func === falseFunc) return func;
99 + return Rules[rule.type](func, rule, options, context, acceptSelf && index === 1);
100 + }, options && options.rootFunc || trueFunc);
101 +}
102 +
103 +function reduceRules(a, b){
104 + if(b === falseFunc || a === trueFunc){
105 + return a;
106 + }
107 + if(a === falseFunc || b === trueFunc){
108 + return b;
109 + }
110 +
111 + return function combine(elem){
112 + return a(elem) || b(elem);
113 + };
114 +}
115 +
116 +//:not, :has and :matches have to compile selectors
117 +//doing this in lib/pseudos.js would lead to circular dependencies,
118 +//so we add them here
119 +
120 +var Pseudos = require("./pseudos.js"),
121 + filters = Pseudos.filters,
122 + existsOne = DomUtils.existsOne,
123 + isTag = DomUtils.isTag,
124 + getChildren = DomUtils.getChildren;
125 +
126 +
127 +function containsTraversal(t){
128 + return t.some(isTraversal);
129 +}
130 +
131 +filters.not = function(next, token, options, context){
132 + var opts = {
133 + xmlMode: !!(options && options.xmlMode),
134 + strict: !!(options && options.strict)
135 + };
136 +
137 + if(opts.strict){
138 + if(token.length > 1 || token.some(containsTraversal)){
139 + throw new SyntaxError("complex selectors in :not aren't allowed in strict mode");
140 + }
141 + }
142 +
143 + var func = compileToken(token, opts, context);
144 +
145 + if(func === falseFunc) return next;
146 + if(func === trueFunc) return falseFunc;
147 +
148 + return function(elem){
149 + return !func(elem) && next(elem);
150 + };
151 +};
152 +
153 +filters.has = function(next, token, options){
154 + var opts = {
155 + xmlMode: !!(options && options.xmlMode),
156 + strict: !!(options && options.strict)
157 + };
158 +
159 + //FIXME: Uses an array as a pointer to the current element (side effects)
160 + var context = token.some(containsTraversal) ? [PLACEHOLDER_ELEMENT] : null;
161 +
162 + var func = compileToken(token, opts, context);
163 +
164 + if(func === falseFunc) return falseFunc;
165 + if(func === trueFunc) return function(elem){
166 + return getChildren(elem).some(isTag) && next(elem);
167 + };
168 +
169 + func = wrap(func);
170 +
171 + if(context){
172 + return function has(elem){
173 + return next(elem) && (
174 + (context[0] = elem), existsOne(func, getChildren(elem))
175 + );
176 + };
177 + }
178 +
179 + return function has(elem){
180 + return next(elem) && existsOne(func, getChildren(elem));
181 + };
182 +};
183 +
184 +filters.matches = function(next, token, options, context){
185 + var opts = {
186 + xmlMode: !!(options && options.xmlMode),
187 + strict: !!(options && options.strict),
188 + rootFunc: next
189 + };
190 +
191 + return compileToken(token, opts, context);
192 +};
1 +var DomUtils = require("domutils"),
2 + isTag = DomUtils.isTag,
3 + getParent = DomUtils.getParent,
4 + getChildren = DomUtils.getChildren,
5 + getSiblings = DomUtils.getSiblings,
6 + getName = DomUtils.getName;
7 +
8 +/*
9 + all available rules
10 +*/
11 +module.exports = {
12 + __proto__: null,
13 +
14 + attribute: require("./attributes.js").compile,
15 + pseudo: require("./pseudos.js").compile,
16 +
17 + //tags
18 + tag: function(next, data){
19 + var name = data.name;
20 + return function tag(elem){
21 + return getName(elem) === name && next(elem);
22 + };
23 + },
24 +
25 + //traversal
26 + descendant: function(next, rule, options, context, acceptSelf){
27 + return function descendant(elem){
28 +
29 + if (acceptSelf && next(elem)) return true;
30 +
31 + var found = false;
32 +
33 + while(!found && (elem = getParent(elem))){
34 + found = next(elem);
35 + }
36 +
37 + return found;
38 + };
39 + },
40 + parent: function(next, data, options){
41 + if(options && options.strict) throw SyntaxError("Parent selector isn't part of CSS3");
42 +
43 + return function parent(elem){
44 + return getChildren(elem).some(test);
45 + };
46 +
47 + function test(elem){
48 + return isTag(elem) && next(elem);
49 + }
50 + },
51 + child: function(next){
52 + return function child(elem){
53 + var parent = getParent(elem);
54 + return !!parent && next(parent);
55 + };
56 + },
57 + sibling: function(next){
58 + return function sibling(elem){
59 + var siblings = getSiblings(elem);
60 +
61 + for(var i = 0; i < siblings.length; i++){
62 + if(isTag(siblings[i])){
63 + if(siblings[i] === elem) break;
64 + if(next(siblings[i])) return true;
65 + }
66 + }
67 +
68 + return false;
69 + };
70 + },
71 + adjacent: function(next){
72 + return function adjacent(elem){
73 + var siblings = getSiblings(elem),
74 + lastElement;
75 +
76 + for(var i = 0; i < siblings.length; i++){
77 + if(isTag(siblings[i])){
78 + if(siblings[i] === elem) break;
79 + lastElement = siblings[i];
80 + }
81 + }
82 +
83 + return !!lastElement && next(lastElement);
84 + };
85 + },
86 + universal: function(next){
87 + return next;
88 + }
89 +};
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "universal": 50,
3 + "tag": 30,
4 + "attribute": 1,
5 + "pseudo": 0,
6 + "descendant": -1,
7 + "child": -1,
8 + "parent": -1,
9 + "sibling": -1,
10 + "adjacent": -1
11 +}
1 +/*
2 + pseudo selectors
3 +
4 + ---
5 +
6 + they are available in two forms:
7 + * filters called when the selector
8 + is compiled and return a function
9 + that needs to return next()
10 + * pseudos get called on execution
11 + they need to return a boolean
12 +*/
13 +
14 +var DomUtils = require("domutils"),
15 + isTag = DomUtils.isTag,
16 + getText = DomUtils.getText,
17 + getParent = DomUtils.getParent,
18 + getChildren = DomUtils.getChildren,
19 + getSiblings = DomUtils.getSiblings,
20 + hasAttrib = DomUtils.hasAttrib,
21 + getName = DomUtils.getName,
22 + getAttribute= DomUtils.getAttributeValue,
23 + getNCheck = require("nth-check"),
24 + checkAttrib = require("./attributes.js").rules.equals,
25 + BaseFuncs = require("boolbase"),
26 + trueFunc = BaseFuncs.trueFunc,
27 + falseFunc = BaseFuncs.falseFunc;
28 +
29 +//helper methods
30 +function getFirstElement(elems){
31 + for(var i = 0; elems && i < elems.length; i++){
32 + if(isTag(elems[i])) return elems[i];
33 + }
34 +}
35 +
36 +function getAttribFunc(name, value){
37 + var data = {name: name, value: value};
38 + return function attribFunc(next){
39 + return checkAttrib(next, data);
40 + };
41 +}
42 +
43 +function getChildFunc(next){
44 + return function(elem){
45 + return !!getParent(elem) && next(elem);
46 + };
47 +}
48 +
49 +var filters = {
50 + contains: function(next, text){
51 + return function contains(elem){
52 + return next(elem) && getText(elem).indexOf(text) >= 0;
53 + };
54 + },
55 + icontains: function(next, text){
56 + var itext = text.toLowerCase();
57 + return function icontains(elem){
58 + return next(elem) &&
59 + getText(elem).toLowerCase().indexOf(itext) >= 0;
60 + };
61 + },
62 +
63 + //location specific methods
64 + "nth-child": function(next, rule){
65 + var func = getNCheck(rule);
66 +
67 + if(func === falseFunc) return func;
68 + if(func === trueFunc) return getChildFunc(next);
69 +
70 + return function nthChild(elem){
71 + var siblings = getSiblings(elem);
72 +
73 + for(var i = 0, pos = 0; i < siblings.length; i++){
74 + if(isTag(siblings[i])){
75 + if(siblings[i] === elem) break;
76 + else pos++;
77 + }
78 + }
79 +
80 + return func(pos) && next(elem);
81 + };
82 + },
83 + "nth-last-child": function(next, rule){
84 + var func = getNCheck(rule);
85 +
86 + if(func === falseFunc) return func;
87 + if(func === trueFunc) return getChildFunc(next);
88 +
89 + return function nthLastChild(elem){
90 + var siblings = getSiblings(elem);
91 +
92 + for(var pos = 0, i = siblings.length - 1; i >= 0; i--){
93 + if(isTag(siblings[i])){
94 + if(siblings[i] === elem) break;
95 + else pos++;
96 + }
97 + }
98 +
99 + return func(pos) && next(elem);
100 + };
101 + },
102 + "nth-of-type": function(next, rule){
103 + var func = getNCheck(rule);
104 +
105 + if(func === falseFunc) return func;
106 + if(func === trueFunc) return getChildFunc(next);
107 +
108 + return function nthOfType(elem){
109 + var siblings = getSiblings(elem);
110 +
111 + for(var pos = 0, i = 0; i < siblings.length; i++){
112 + if(isTag(siblings[i])){
113 + if(siblings[i] === elem) break;
114 + if(getName(siblings[i]) === getName(elem)) pos++;
115 + }
116 + }
117 +
118 + return func(pos) && next(elem);
119 + };
120 + },
121 + "nth-last-of-type": function(next, rule){
122 + var func = getNCheck(rule);
123 +
124 + if(func === falseFunc) return func;
125 + if(func === trueFunc) return getChildFunc(next);
126 +
127 + return function nthLastOfType(elem){
128 + var siblings = getSiblings(elem);
129 +
130 + for(var pos = 0, i = siblings.length - 1; i >= 0; i--){
131 + if(isTag(siblings[i])){
132 + if(siblings[i] === elem) break;
133 + if(getName(siblings[i]) === getName(elem)) pos++;
134 + }
135 + }
136 +
137 + return func(pos) && next(elem);
138 + };
139 + },
140 +
141 + //TODO determine the actual root element
142 + root: function(next){
143 + return function(elem){
144 + return !getParent(elem) && next(elem);
145 + };
146 + },
147 +
148 + scope: function(next, rule, options, context){
149 + if(!context || context.length === 0){
150 + //equivalent to :root
151 + return filters.root(next);
152 + }
153 +
154 + if(context.length === 1){
155 + //NOTE: can't be unpacked, as :has uses this for side-effects
156 + return function(elem){
157 + return context[0] === elem && next(elem);
158 + };
159 + }
160 +
161 + return function(elem){
162 + return context.indexOf(elem) >= 0 && next(elem);
163 + };
164 + },
165 +
166 + //jQuery extensions (others follow as pseudos)
167 + checkbox: getAttribFunc("type", "checkbox"),
168 + file: getAttribFunc("type", "file"),
169 + password: getAttribFunc("type", "password"),
170 + radio: getAttribFunc("type", "radio"),
171 + reset: getAttribFunc("type", "reset"),
172 + image: getAttribFunc("type", "image"),
173 + submit: getAttribFunc("type", "submit")
174 +};
175 +
176 +//while filters are precompiled, pseudos get called when they are needed
177 +var pseudos = {
178 + empty: function(elem){
179 + return !getChildren(elem).some(function(elem){
180 + return isTag(elem) || elem.type === "text";
181 + });
182 + },
183 +
184 + "first-child": function(elem){
185 + return getFirstElement(getSiblings(elem)) === elem;
186 + },
187 + "last-child": function(elem){
188 + var siblings = getSiblings(elem);
189 +
190 + for(var i = siblings.length - 1; i >= 0; i--){
191 + if(siblings[i] === elem) return true;
192 + if(isTag(siblings[i])) break;
193 + }
194 +
195 + return false;
196 + },
197 + "first-of-type": function(elem){
198 + var siblings = getSiblings(elem);
199 +
200 + for(var i = 0; i < siblings.length; i++){
201 + if(isTag(siblings[i])){
202 + if(siblings[i] === elem) return true;
203 + if(getName(siblings[i]) === getName(elem)) break;
204 + }
205 + }
206 +
207 + return false;
208 + },
209 + "last-of-type": function(elem){
210 + var siblings = getSiblings(elem);
211 +
212 + for(var i = siblings.length-1; i >= 0; i--){
213 + if(isTag(siblings[i])){
214 + if(siblings[i] === elem) return true;
215 + if(getName(siblings[i]) === getName(elem)) break;
216 + }
217 + }
218 +
219 + return false;
220 + },
221 + "only-of-type": function(elem){
222 + var siblings = getSiblings(elem);
223 +
224 + for(var i = 0, j = siblings.length; i < j; i++){
225 + if(isTag(siblings[i])){
226 + if(siblings[i] === elem) continue;
227 + if(getName(siblings[i]) === getName(elem)) return false;
228 + }
229 + }
230 +
231 + return true;
232 + },
233 + "only-child": function(elem){
234 + var siblings = getSiblings(elem);
235 +
236 + for(var i = 0; i < siblings.length; i++){
237 + if(isTag(siblings[i]) && siblings[i] !== elem) return false;
238 + }
239 +
240 + return true;
241 + },
242 +
243 + //:matches(a, area, link)[href]
244 + link: function(elem){
245 + return hasAttrib(elem, "href");
246 + },
247 + visited: falseFunc, //seems to be a valid implementation
248 + //TODO: :any-link once the name is finalized (as an alias of :link)
249 +
250 + //forms
251 + //to consider: :target
252 +
253 + //:matches([selected], select:not([multiple]):not(> option[selected]) > option:first-of-type)
254 + selected: function(elem){
255 + if(hasAttrib(elem, "selected")) return true;
256 + else if(getName(elem) !== "option") return false;
257 +
258 + //the first <option> in a <select> is also selected
259 + var parent = getParent(elem);
260 +
261 + if(
262 + !parent ||
263 + getName(parent) !== "select" ||
264 + hasAttrib(parent, "multiple")
265 + ) return false;
266 +
267 + var siblings = getChildren(parent),
268 + sawElem = false;
269 +
270 + for(var i = 0; i < siblings.length; i++){
271 + if(isTag(siblings[i])){
272 + if(siblings[i] === elem){
273 + sawElem = true;
274 + } else if(!sawElem){
275 + return false;
276 + } else if(hasAttrib(siblings[i], "selected")){
277 + return false;
278 + }
279 + }
280 + }
281 +
282 + return sawElem;
283 + },
284 + //https://html.spec.whatwg.org/multipage/scripting.html#disabled-elements
285 + //:matches(
286 + // :matches(button, input, select, textarea, menuitem, optgroup, option)[disabled],
287 + // optgroup[disabled] > option),
288 + // fieldset[disabled] * //TODO not child of first <legend>
289 + //)
290 + disabled: function(elem){
291 + return hasAttrib(elem, "disabled");
292 + },
293 + enabled: function(elem){
294 + return !hasAttrib(elem, "disabled");
295 + },
296 + //:matches(:matches(:radio, :checkbox)[checked], :selected) (TODO menuitem)
297 + checked: function(elem){
298 + return hasAttrib(elem, "checked") || pseudos.selected(elem);
299 + },
300 + //:matches(input, select, textarea)[required]
301 + required: function(elem){
302 + return hasAttrib(elem, "required");
303 + },
304 + //:matches(input, select, textarea):not([required])
305 + optional: function(elem){
306 + return !hasAttrib(elem, "required");
307 + },
308 +
309 + //jQuery extensions
310 +
311 + //:not(:empty)
312 + parent: function(elem){
313 + return !pseudos.empty(elem);
314 + },
315 + //:matches(h1, h2, h3, h4, h5, h6)
316 + header: function(elem){
317 + var name = getName(elem);
318 + return name === "h1" ||
319 + name === "h2" ||
320 + name === "h3" ||
321 + name === "h4" ||
322 + name === "h5" ||
323 + name === "h6";
324 + },
325 +
326 + //:matches(button, input[type=button])
327 + button: function(elem){
328 + var name = getName(elem);
329 + return name === "button" ||
330 + name === "input" &&
331 + getAttribute(elem, "type") === "button";
332 + },
333 + //:matches(input, textarea, select, button)
334 + input: function(elem){
335 + var name = getName(elem);
336 + return name === "input" ||
337 + name === "textarea" ||
338 + name === "select" ||
339 + name === "button";
340 + },
341 + //input:matches(:not([type!='']), [type='text' i])
342 + text: function(elem){
343 + var attr;
344 + return getName(elem) === "input" && (
345 + !(attr = getAttribute(elem, "type")) ||
346 + attr.toLowerCase() === "text"
347 + );
348 + }
349 +};
350 +
351 +function verifyArgs(func, name, subselect){
352 + if(subselect === null){
353 + if(func.length > 1 && name !== "scope"){
354 + throw new SyntaxError("pseudo-selector :" + name + " requires an argument");
355 + }
356 + } else {
357 + if(func.length === 1){
358 + throw new SyntaxError("pseudo-selector :" + name + " doesn't have any arguments");
359 + }
360 + }
361 +}
362 +
363 +//FIXME this feels hacky
364 +var re_CSS3 = /^(?:(?:nth|last|first|only)-(?:child|of-type)|root|empty|(?:en|dis)abled|checked|not)$/;
365 +
366 +module.exports = {
367 + compile: function(next, data, options, context){
368 + var name = data.name,
369 + subselect = data.data;
370 +
371 + if(options && options.strict && !re_CSS3.test(name)){
372 + throw SyntaxError(":" + name + " isn't part of CSS3");
373 + }
374 +
375 + if(typeof filters[name] === "function"){
376 + verifyArgs(filters[name], name, subselect);
377 + return filters[name](next, subselect, options, context);
378 + } else if(typeof pseudos[name] === "function"){
379 + var func = pseudos[name];
380 + verifyArgs(func, name, subselect);
381 +
382 + if(next === trueFunc) return func;
383 +
384 + return function pseudoArgs(elem){
385 + return func(elem, subselect) && next(elem);
386 + };
387 + } else {
388 + throw new SyntaxError("unmatched pseudo-class :" + name);
389 + }
390 + },
391 + filters: filters,
392 + pseudos: pseudos
393 +};
1 +module.exports = sortByProcedure;
2 +
3 +/*
4 + sort the parts of the passed selector,
5 + as there is potential for optimization
6 + (some types of selectors are faster than others)
7 +*/
8 +
9 +var procedure = require("./procedure.json");
10 +
11 +var attributes = {
12 + __proto__: null,
13 + exists: 10,
14 + equals: 8,
15 + not: 7,
16 + start: 6,
17 + end: 6,
18 + any: 5,
19 + hyphen: 4,
20 + element: 4
21 +};
22 +
23 +function sortByProcedure(arr){
24 + var procs = arr.map(getProcedure);
25 + for(var i = 1; i < arr.length; i++){
26 + var procNew = procs[i];
27 +
28 + if(procNew < 0) continue;
29 +
30 + for(var j = i - 1; j >= 0 && procNew < procs[j]; j--){
31 + var token = arr[j + 1];
32 + arr[j + 1] = arr[j];
33 + arr[j] = token;
34 + procs[j + 1] = procs[j];
35 + procs[j] = procNew;
36 + }
37 + }
38 +}
39 +
40 +function getProcedure(token){
41 + var proc = procedure[token.type];
42 +
43 + if(proc === procedure.attribute){
44 + proc = attributes[token.action];
45 +
46 + if(proc === attributes.equals && token.name === "id"){
47 + //prefer ID selectors (eg. #ID)
48 + proc = 9;
49 + }
50 +
51 + if(token.ignoreCase){
52 + //ignoreCase adds some overhead, prefer "normal" token
53 + //this is a binary operation, to ensure it's still an int
54 + proc >>= 1;
55 + }
56 + } else if(proc === procedure.pseudo){
57 + if(!token.data){
58 + proc = 3;
59 + } else if(token.name === "has" || token.name === "contains"){
60 + proc = 0; //expensive in any case
61 + } else if(token.name === "matches" || token.name === "not"){
62 + proc = 0;
63 + for(var i = 0; i < token.data.length; i++){
64 + //TODO better handling of complex selectors
65 + if(token.data[i].length !== 1) continue;
66 + var cur = getProcedure(token.data[i][0]);
67 + //avoid executing :has or :contains
68 + if(cur === 0){
69 + proc = 0;
70 + break;
71 + }
72 + if(cur > proc) proc = cur;
73 + }
74 + if(token.data.length > 1 && proc > 0) proc -= 1;
75 + } else {
76 + proc = 1;
77 + }
78 + }
79 + return proc;
80 +}
1 +{
2 + "_args": [
3 + [
4 + {
5 + "raw": "css-select@~1.2.0",
6 + "scope": null,
7 + "escapedName": "css-select",
8 + "name": "css-select",
9 + "rawSpec": "~1.2.0",
10 + "spec": ">=1.2.0 <1.3.0",
11 + "type": "range"
12 + },
13 + "C:\\Users\\hyshs\\Desktop\\OSS_Project\\node_modules\\cheerio"
14 + ]
15 + ],
16 + "_from": "css-select@>=1.2.0 <1.3.0",
17 + "_id": "css-select@1.2.0",
18 + "_inCache": true,
19 + "_location": "/css-select",
20 + "_nodeVersion": "5.0.0",
21 + "_npmUser": {
22 + "name": "feedic",
23 + "email": "me@feedic.com"
24 + },
25 + "_npmVersion": "3.3.9",
26 + "_phantomChildren": {},
27 + "_requested": {
28 + "raw": "css-select@~1.2.0",
29 + "scope": null,
30 + "escapedName": "css-select",
31 + "name": "css-select",
32 + "rawSpec": "~1.2.0",
33 + "spec": ">=1.2.0 <1.3.0",
34 + "type": "range"
35 + },
36 + "_requiredBy": [
37 + "/cheerio"
38 + ],
39 + "_resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz",
40 + "_shasum": "2b3a110539c5355f1cd8d314623e870b121ec858",
41 + "_shrinkwrap": null,
42 + "_spec": "css-select@~1.2.0",
43 + "_where": "C:\\Users\\hyshs\\Desktop\\OSS_Project\\node_modules\\cheerio",
44 + "author": {
45 + "name": "Felix Boehm",
46 + "email": "me@feedic.com"
47 + },
48 + "bugs": {
49 + "url": "https://github.com/fb55/css-select/issues"
50 + },
51 + "dependencies": {
52 + "boolbase": "~1.0.0",
53 + "css-what": "2.1",
54 + "domutils": "1.5.1",
55 + "nth-check": "~1.0.1"
56 + },
57 + "description": "a CSS selector compiler/engine",
58 + "devDependencies": {
59 + "cheerio-soupselect": "*",
60 + "coveralls": "*",
61 + "expect.js": "*",
62 + "htmlparser2": "*",
63 + "istanbul": "*",
64 + "jshint": "2",
65 + "mocha": "*",
66 + "mocha-lcov-reporter": "*"
67 + },
68 + "directories": {},
69 + "dist": {
70 + "shasum": "2b3a110539c5355f1cd8d314623e870b121ec858",
71 + "tarball": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz"
72 + },
73 + "files": [
74 + "index.js",
75 + "lib"
76 + ],
77 + "gitHead": "09c405d8296bd97a660256604d8cdfb23fca47b6",
78 + "homepage": "https://github.com/fb55/css-select#readme",
79 + "jshintConfig": {
80 + "eqeqeq": true,
81 + "freeze": true,
82 + "latedef": "nofunc",
83 + "noarg": true,
84 + "nonbsp": true,
85 + "quotmark": "double",
86 + "undef": true,
87 + "unused": true,
88 + "trailing": true,
89 + "eqnull": true,
90 + "proto": true,
91 + "smarttabs": true,
92 + "node": true,
93 + "globals": {
94 + "describe": true,
95 + "it": true
96 + }
97 + },
98 + "keywords": [
99 + "css",
100 + "selector",
101 + "sizzle"
102 + ],
103 + "license": "BSD-like",
104 + "maintainers": [
105 + {
106 + "name": "feedic",
107 + "email": "me@feedic.com"
108 + }
109 + ],
110 + "name": "css-select",
111 + "optionalDependencies": {},
112 + "readme": "ERROR: No README data found!",
113 + "repository": {
114 + "type": "git",
115 + "url": "git://github.com/fb55/css-select.git"
116 + },
117 + "scripts": {
118 + "coveralls": "npm run lint && npm run lcov && (cat coverage/lcov.info | coveralls || exit 0)",
119 + "lcov": "istanbul cover _mocha --report lcovonly -- -R spec",
120 + "lint": "jshint index.js lib/*.js test/*.js",
121 + "test": "mocha && npm run lint"
122 + },
123 + "version": "1.2.0"
124 +}
1 +Copyright (c) Felix Böhm
2 +All rights reserved.
3 +
4 +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5 +
6 +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7 +
8 +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 +
10 +THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
11 +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1 +"use strict";
2 +
3 +module.exports = parse;
4 +
5 +var re_name = /^(?:\\.|[\w\-\u00c0-\uFFFF])+/,
6 + re_escape = /\\([\da-f]{1,6}\s?|(\s)|.)/ig,
7 + //modified version of https://github.com/jquery/sizzle/blob/master/src/sizzle.js#L87
8 + re_attr = /^\s*((?:\\.|[\w\u00c0-\uFFFF\-])+)\s*(?:(\S?)=\s*(?:(['"])(.*?)\3|(#?(?:\\.|[\w\u00c0-\uFFFF\-])*)|)|)\s*(i)?\]/;
9 +
10 +var actionTypes = {
11 + __proto__: null,
12 + "undefined": "exists",
13 + "": "equals",
14 + "~": "element",
15 + "^": "start",
16 + "$": "end",
17 + "*": "any",
18 + "!": "not",
19 + "|": "hyphen"
20 +};
21 +
22 +var simpleSelectors = {
23 + __proto__: null,
24 + ">": "child",
25 + "<": "parent",
26 + "~": "sibling",
27 + "+": "adjacent"
28 +};
29 +
30 +var attribSelectors = {
31 + __proto__: null,
32 + "#": ["id", "equals"],
33 + ".": ["class", "element"]
34 +};
35 +
36 +//pseudos, whose data-property is parsed as well
37 +var unpackPseudos = {
38 + __proto__: null,
39 + "has": true,
40 + "not": true,
41 + "matches": true
42 +};
43 +
44 +var stripQuotesFromPseudos = {
45 + __proto__: null,
46 + "contains": true,
47 + "icontains": true
48 +};
49 +
50 +var quotes = {
51 + __proto__: null,
52 + "\"": true,
53 + "'": true
54 +};
55 +
56 +//unescape function taken from https://github.com/jquery/sizzle/blob/master/src/sizzle.js#L139
57 +function funescape( _, escaped, escapedWhitespace ) {
58 + var high = "0x" + escaped - 0x10000;
59 + // NaN means non-codepoint
60 + // Support: Firefox
61 + // Workaround erroneous numeric interpretation of +"0x"
62 + return high !== high || escapedWhitespace ?
63 + escaped :
64 + // BMP codepoint
65 + high < 0 ?
66 + String.fromCharCode( high + 0x10000 ) :
67 + // Supplemental Plane codepoint (surrogate pair)
68 + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
69 +}
70 +
71 +function unescapeCSS(str){
72 + return str.replace(re_escape, funescape);
73 +}
74 +
75 +function isWhitespace(c){
76 + return c === " " || c === "\n" || c === "\t" || c === "\f" || c === "\r";
77 +}
78 +
79 +function parse(selector, options){
80 + var subselects = [];
81 +
82 + selector = parseSelector(subselects, selector + "", options);
83 +
84 + if(selector !== ""){
85 + throw new SyntaxError("Unmatched selector: " + selector);
86 + }
87 +
88 + return subselects;
89 +}
90 +
91 +function parseSelector(subselects, selector, options){
92 + var tokens = [],
93 + sawWS = false,
94 + data, firstChar, name, quot;
95 +
96 + function getName(){
97 + var sub = selector.match(re_name)[0];
98 + selector = selector.substr(sub.length);
99 + return unescapeCSS(sub);
100 + }
101 +
102 + function stripWhitespace(start){
103 + while(isWhitespace(selector.charAt(start))) start++;
104 + selector = selector.substr(start);
105 + }
106 +
107 + stripWhitespace(0);
108 +
109 + while(selector !== ""){
110 + firstChar = selector.charAt(0);
111 +
112 + if(isWhitespace(firstChar)){
113 + sawWS = true;
114 + stripWhitespace(1);
115 + } else if(firstChar in simpleSelectors){
116 + tokens.push({type: simpleSelectors[firstChar]});
117 + sawWS = false;
118 +
119 + stripWhitespace(1);
120 + } else if(firstChar === ","){
121 + if(tokens.length === 0){
122 + throw new SyntaxError("empty sub-selector");
123 + }
124 + subselects.push(tokens);
125 + tokens = [];
126 + sawWS = false;
127 + stripWhitespace(1);
128 + } else {
129 + if(sawWS){
130 + if(tokens.length > 0){
131 + tokens.push({type: "descendant"});
132 + }
133 + sawWS = false;
134 + }
135 +
136 + if(firstChar === "*"){
137 + selector = selector.substr(1);
138 + tokens.push({type: "universal"});
139 + } else if(firstChar in attribSelectors){
140 + selector = selector.substr(1);
141 + tokens.push({
142 + type: "attribute",
143 + name: attribSelectors[firstChar][0],
144 + action: attribSelectors[firstChar][1],
145 + value: getName(),
146 + ignoreCase: false
147 + });
148 + } else if(firstChar === "["){
149 + selector = selector.substr(1);
150 + data = selector.match(re_attr);
151 + if(!data){
152 + throw new SyntaxError("Malformed attribute selector: " + selector);
153 + }
154 + selector = selector.substr(data[0].length);
155 + name = unescapeCSS(data[1]);
156 +
157 + if(
158 + !options || (
159 + "lowerCaseAttributeNames" in options ?
160 + options.lowerCaseAttributeNames :
161 + !options.xmlMode
162 + )
163 + ){
164 + name = name.toLowerCase();
165 + }
166 +
167 + tokens.push({
168 + type: "attribute",
169 + name: name,
170 + action: actionTypes[data[2]],
171 + value: unescapeCSS(data[4] || data[5] || ""),
172 + ignoreCase: !!data[6]
173 + });
174 +
175 + } else if(firstChar === ":"){
176 + if(selector.charAt(1) === ":"){
177 + selector = selector.substr(2);
178 + tokens.push({type: "pseudo-element", name: getName().toLowerCase()});
179 + continue;
180 + }
181 +
182 + selector = selector.substr(1);
183 +
184 + name = getName().toLowerCase();
185 + data = null;
186 +
187 + if(selector.charAt(0) === "("){
188 + if(name in unpackPseudos){
189 + quot = selector.charAt(1);
190 + var quoted = quot in quotes;
191 +
192 + selector = selector.substr(quoted + 1);
193 +
194 + data = [];
195 + selector = parseSelector(data, selector, options);
196 +
197 + if(quoted){
198 + if(selector.charAt(0) !== quot){
199 + throw new SyntaxError("unmatched quotes in :" + name);
200 + } else {
201 + selector = selector.substr(1);
202 + }
203 + }
204 +
205 + if(selector.charAt(0) !== ")"){
206 + throw new SyntaxError("missing closing parenthesis in :" + name + " " + selector);
207 + }
208 +
209 + selector = selector.substr(1);
210 + } else {
211 + var pos = 1, counter = 1;
212 +
213 + for(; counter > 0 && pos < selector.length; pos++){
214 + if(selector.charAt(pos) === "(") counter++;
215 + else if(selector.charAt(pos) === ")") counter--;
216 + }
217 +
218 + if(counter){
219 + throw new SyntaxError("parenthesis not matched");
220 + }
221 +
222 + data = selector.substr(1, pos - 2);
223 + selector = selector.substr(pos);
224 +
225 + if(name in stripQuotesFromPseudos){
226 + quot = data.charAt(0);
227 +
228 + if(quot === data.slice(-1) && quot in quotes){
229 + data = data.slice(1, -1);
230 + }
231 +
232 + data = unescapeCSS(data);
233 + }
234 + }
235 + }
236 +
237 + tokens.push({type: "pseudo", name: name, data: data});
238 + } else if(re_name.test(selector)){
239 + name = getName();
240 +
241 + if(!options || ("lowerCaseTags" in options ? options.lowerCaseTags : !options.xmlMode)){
242 + name = name.toLowerCase();
243 + }
244 +
245 + tokens.push({type: "tag", name: name});
246 + } else {
247 + if(tokens.length && tokens[tokens.length - 1].type === "descendant"){
248 + tokens.pop();
249 + }
250 + addToken(subselects, tokens);
251 + return selector;
252 + }
253 + }
254 + }
255 +
256 + addToken(subselects, tokens);
257 +
258 + return selector;
259 +}
260 +
261 +function addToken(subselects, tokens){
262 + if(subselects.length > 0 && tokens.length === 0){
263 + throw new SyntaxError("empty sub-selector");
264 + }
265 +
266 + subselects.push(tokens);
267 +}
1 +{
2 + "_args": [
3 + [
4 + {
5 + "raw": "css-what@2.1",
6 + "scope": null,
7 + "escapedName": "css-what",
8 + "name": "css-what",
9 + "rawSpec": "2.1",
10 + "spec": ">=2.1.0 <2.2.0",
11 + "type": "range"
12 + },
13 + "C:\\Users\\hyshs\\Desktop\\OSS_Project\\node_modules\\css-select"
14 + ]
15 + ],
16 + "_from": "css-what@>=2.1.0 <2.2.0",
17 + "_id": "css-what@2.1.0",
18 + "_inCache": true,
19 + "_location": "/css-what",
20 + "_nodeVersion": "5.0.0",
21 + "_npmUser": {
22 + "name": "feedic",
23 + "email": "me@feedic.com"
24 + },
25 + "_npmVersion": "3.3.9",
26 + "_phantomChildren": {},
27 + "_requested": {
28 + "raw": "css-what@2.1",
29 + "scope": null,
30 + "escapedName": "css-what",
31 + "name": "css-what",
32 + "rawSpec": "2.1",
33 + "spec": ">=2.1.0 <2.2.0",
34 + "type": "range"
35 + },
36 + "_requiredBy": [
37 + "/css-select"
38 + ],
39 + "_resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.0.tgz",
40 + "_shasum": "9467d032c38cfaefb9f2d79501253062f87fa1bd",
41 + "_shrinkwrap": null,
42 + "_spec": "css-what@2.1",
43 + "_where": "C:\\Users\\hyshs\\Desktop\\OSS_Project\\node_modules\\css-select",
44 + "author": {
45 + "name": "Felix Böhm",
46 + "email": "me@feedic.com",
47 + "url": "http://feedic.com"
48 + },
49 + "bugs": {
50 + "url": "https://github.com/fb55/css-what/issues"
51 + },
52 + "dependencies": {},
53 + "description": "a CSS selector parser",
54 + "devDependencies": {
55 + "jshint": "2"
56 + },
57 + "directories": {},
58 + "dist": {
59 + "shasum": "9467d032c38cfaefb9f2d79501253062f87fa1bd",
60 + "tarball": "https://registry.npmjs.org/css-what/-/css-what-2.1.0.tgz"
61 + },
62 + "engines": {
63 + "node": "*"
64 + },
65 + "files": [
66 + "index.js"
67 + ],
68 + "gitHead": "fd6b9f62146efec8e17ee80ddaebdfb6ede21d7b",
69 + "homepage": "https://github.com/fb55/css-what#readme",
70 + "jshintConfig": {
71 + "eqeqeq": true,
72 + "freeze": true,
73 + "latedef": "nofunc",
74 + "noarg": true,
75 + "nonbsp": true,
76 + "quotmark": "double",
77 + "undef": true,
78 + "unused": true,
79 + "trailing": true,
80 + "eqnull": true,
81 + "proto": true,
82 + "smarttabs": true,
83 + "node": true,
84 + "globals": {
85 + "describe": true,
86 + "it": true
87 + }
88 + },
89 + "license": "BSD-like",
90 + "main": "./index.js",
91 + "maintainers": [
92 + {
93 + "name": "feedic",
94 + "email": "me@feedic.com"
95 + }
96 + ],
97 + "name": "css-what",
98 + "optionalDependencies": {},
99 + "readme": "ERROR: No README data found!",
100 + "repository": {
101 + "url": "git+https://github.com/fb55/css-what.git"
102 + },
103 + "scripts": {
104 + "test": "node tests/test.js && jshint *.js"
105 + },
106 + "version": "2.1.0"
107 +}
1 +# css-what [![Build Status](https://secure.travis-ci.org/fb55/css-what.svg?branch=master)](http://travis-ci.org/fb55/css-what)
2 +
3 +a CSS selector parser
4 +
5 +## Example
6 +
7 +```js
8 +require('css-what')('foo[bar]:baz')
9 +
10 +~> [ [ { type: 'tag', name: 'foo' },
11 + { type: 'attribute',
12 + name: 'bar',
13 + action: 'exists',
14 + value: '',
15 + ignoreCase: false },
16 + { type: 'pseudo',
17 + name: 'baz',
18 + data: null } ] ]
19 +```
20 +
21 +## API
22 +
23 +__`CSSwhat(selector, options)` - Parses `str`, with the passed `options`.__
24 +
25 +The function returns a two-dimensional array. The first array represents selectors separated by commas (eg. `sub1, sub2`), the second contains the relevant tokens for that selector. Possible token types are:
26 +
27 +name | attributes | example | output
28 +---- | ---------- | ------- | ------
29 +`tag`| `name` | `div` | `{ type: 'tag', name: 'div' }`
30 +`universal`| - | `*` | `{ type: 'universal' }`
31 +`pseudo`| `name`, `data`|`:name(data)`| `{ type: 'pseudo', name: 'name', data: 'data' }`
32 +`pseudo`| `name`, `data`|`:name`| `{ type: 'pseudo', name: 'name', data: null }`
33 +`attribute`|`name`, `action`, `value`, `ignoreCase`|`[attr]`|`{ type: 'attribute', name: 'attr', action: 'exists', value: '', ignoreCase: false }`
34 +`attribute`|`name`, `action`, `value`, `ignoreCase`|`[attr=val]`|`{ type: 'attribute', name: 'attr', action: 'equals', value: 'val', ignoreCase: false }`
35 +`attribute`|`name`, `action`, `value`, `ignoreCase`|`[attr^=val]`|`{ type: 'attribute', name: 'attr', action: 'start', value: 'val', ignoreCase: false }`
36 +`attribute`|`name`, `action`, `value`, `ignoreCase`|`[attr$=val]`|`{ type: 'attribute', name: 'attr', action: 'end', value: 'val', ignoreCase: false }`
37 +
38 +//TODO complete list
39 +
40 +__Options:__
41 +
42 +- `xmlMode`: When enabled, tag names will be case-sensitive (meaning they won't be lowercased).
43 +
44 +---
45 +
46 +License: BSD-like
1 +License
2 +
3 +(The MIT License)
4 +
5 +Copyright (c) 2014 The cheeriojs contributors
6 +
7 +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8 +
9 +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10 +
11 +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1 +/*
2 + Module dependencies
3 +*/
4 +var ElementType = require('domelementtype');
5 +var entities = require('entities');
6 +
7 +/*
8 + Boolean Attributes
9 +*/
10 +var booleanAttributes = {
11 + __proto__: null,
12 + allowfullscreen: true,
13 + async: true,
14 + autofocus: true,
15 + autoplay: true,
16 + checked: true,
17 + controls: true,
18 + default: true,
19 + defer: true,
20 + disabled: true,
21 + hidden: true,
22 + ismap: true,
23 + loop: true,
24 + multiple: true,
25 + muted: true,
26 + open: true,
27 + readonly: true,
28 + required: true,
29 + reversed: true,
30 + scoped: true,
31 + seamless: true,
32 + selected: true,
33 + typemustmatch: true
34 +};
35 +
36 +var unencodedElements = {
37 + __proto__: null,
38 + style: true,
39 + script: true,
40 + xmp: true,
41 + iframe: true,
42 + noembed: true,
43 + noframes: true,
44 + plaintext: true,
45 + noscript: true
46 +};
47 +
48 +/*
49 + Format attributes
50 +*/
51 +function formatAttrs(attributes, opts) {
52 + if (!attributes) return;
53 +
54 + var output = '',
55 + value;
56 +
57 + // Loop through the attributes
58 + for (var key in attributes) {
59 + value = attributes[key];
60 + if (output) {
61 + output += ' ';
62 + }
63 +
64 + if (!value && booleanAttributes[key]) {
65 + output += key;
66 + } else {
67 + output += key + '="' + (opts.decodeEntities ? entities.encodeXML(value) : value) + '"';
68 + }
69 + }
70 +
71 + return output;
72 +}
73 +
74 +/*
75 + Self-enclosing tags (stolen from node-htmlparser)
76 +*/
77 +var singleTag = {
78 + __proto__: null,
79 + area: true,
80 + base: true,
81 + basefont: true,
82 + br: true,
83 + col: true,
84 + command: true,
85 + embed: true,
86 + frame: true,
87 + hr: true,
88 + img: true,
89 + input: true,
90 + isindex: true,
91 + keygen: true,
92 + link: true,
93 + meta: true,
94 + param: true,
95 + source: true,
96 + track: true,
97 + wbr: true,
98 +};
99 +
100 +
101 +var render = module.exports = function(dom, opts) {
102 + if (!Array.isArray(dom) && !dom.cheerio) dom = [dom];
103 + opts = opts || {};
104 +
105 + var output = '';
106 +
107 + for(var i = 0; i < dom.length; i++){
108 + var elem = dom[i];
109 +
110 + if (elem.type === 'root')
111 + output += render(elem.children, opts);
112 + else if (ElementType.isTag(elem))
113 + output += renderTag(elem, opts);
114 + else if (elem.type === ElementType.Directive)
115 + output += renderDirective(elem);
116 + else if (elem.type === ElementType.Comment)
117 + output += renderComment(elem);
118 + else if (elem.type === ElementType.CDATA)
119 + output += renderCdata(elem);
120 + else
121 + output += renderText(elem, opts);
122 + }
123 +
124 + return output;
125 +};
126 +
127 +function renderTag(elem, opts) {
128 + // Handle SVG
129 + if (elem.name === "svg") opts = {decodeEntities: opts.decodeEntities, xmlMode: true};
130 +
131 + var tag = '<' + elem.name,
132 + attribs = formatAttrs(elem.attribs, opts);
133 +
134 + if (attribs) {
135 + tag += ' ' + attribs;
136 + }
137 +
138 + if (
139 + opts.xmlMode
140 + && (!elem.children || elem.children.length === 0)
141 + ) {
142 + tag += '/>';
143 + } else {
144 + tag += '>';
145 + if (elem.children) {
146 + tag += render(elem.children, opts);
147 + }
148 +
149 + if (!singleTag[elem.name] || opts.xmlMode) {
150 + tag += '</' + elem.name + '>';
151 + }
152 + }
153 +
154 + return tag;
155 +}
156 +
157 +function renderDirective(elem) {
158 + return '<' + elem.data + '>';
159 +}
160 +
161 +function renderText(elem, opts) {
162 + var data = elem.data || '';
163 +
164 + // if entities weren't decoded, no need to encode them back
165 + if (opts.decodeEntities && !(elem.parent && elem.parent.name in unencodedElements)) {
166 + data = entities.encodeXML(data);
167 + }
168 +
169 + return data;
170 +}
171 +
172 +function renderCdata(elem) {
173 + return '<![CDATA[' + elem.children[0].data + ']]>';
174 +}
175 +
176 +function renderComment(elem) {
177 + return '<!--' + elem.data + '-->';
178 +}
1 +Copyright (c) Felix Böhm
2 +All rights reserved.
3 +
4 +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5 +
6 +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7 +
8 +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 +
10 +THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
11 +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1 +//Types of elements found in the DOM
2 +module.exports = {
3 + Text: "text", //Text
4 + Directive: "directive", //<? ... ?>
5 + Comment: "comment", //<!-- ... -->
6 + Script: "script", //<script> tags
7 + Style: "style", //<style> tags
8 + Tag: "tag", //Any tag
9 + CDATA: "cdata", //<![CDATA[ ... ]]>
10 +
11 + isTag: function(elem){
12 + return elem.type === "tag" || elem.type === "script" || elem.type === "style";
13 + }
14 +};
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "_args": [
3 + [
4 + {
5 + "raw": "domelementtype@~1.1.1",
6 + "scope": null,
7 + "escapedName": "domelementtype",
8 + "name": "domelementtype",
9 + "rawSpec": "~1.1.1",
10 + "spec": ">=1.1.1 <1.2.0",
11 + "type": "range"
12 + },
13 + "C:\\Users\\hyshs\\Desktop\\OSS_Project\\node_modules\\dom-serializer"
14 + ]
15 + ],
16 + "_from": "domelementtype@>=1.1.1 <1.2.0",
17 + "_id": "domelementtype@1.1.3",
18 + "_inCache": true,
19 + "_location": "/dom-serializer/domelementtype",
20 + "_nodeVersion": "0.10.32",
21 + "_npmUser": {
22 + "name": "feedic",
23 + "email": "me@feedic.com"
24 + },
25 + "_npmVersion": "2.1.5",
26 + "_phantomChildren": {},
27 + "_requested": {
28 + "raw": "domelementtype@~1.1.1",
29 + "scope": null,
30 + "escapedName": "domelementtype",
31 + "name": "domelementtype",
32 + "rawSpec": "~1.1.1",
33 + "spec": ">=1.1.1 <1.2.0",
34 + "type": "range"
35 + },
36 + "_requiredBy": [
37 + "/dom-serializer"
38 + ],
39 + "_resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz",
40 + "_shasum": "bd28773e2642881aec51544924299c5cd822185b",
41 + "_shrinkwrap": null,
42 + "_spec": "domelementtype@~1.1.1",
43 + "_where": "C:\\Users\\hyshs\\Desktop\\OSS_Project\\node_modules\\dom-serializer",
44 + "author": {
45 + "name": "Felix Boehm",
46 + "email": "me@feedic.com"
47 + },
48 + "bugs": {
49 + "url": "https://github.com/FB55/domelementtype/issues"
50 + },
51 + "dependencies": {},
52 + "description": "all the types of nodes in htmlparser2's dom",
53 + "devDependencies": {},
54 + "directories": {},
55 + "dist": {
56 + "shasum": "bd28773e2642881aec51544924299c5cd822185b",
57 + "tarball": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz"
58 + },
59 + "gitHead": "012a97a1d38737e096de2045b2b5f28768d8187e",
60 + "homepage": "https://github.com/FB55/domelementtype",
61 + "keywords": [
62 + "dom",
63 + "htmlparser2"
64 + ],
65 + "main": "index.js",
66 + "maintainers": [
67 + {
68 + "name": "feedic",
69 + "email": "me@feedic.com"
70 + }
71 + ],
72 + "name": "domelementtype",
73 + "optionalDependencies": {},
74 + "readme": "ERROR: No README data found!",
75 + "repository": {
76 + "type": "git",
77 + "url": "git://github.com/FB55/domelementtype.git"
78 + },
79 + "scripts": {},
80 + "version": "1.1.3"
81 +}
1 +all the types of nodes in htmlparser2's dom
1 +{
2 + "_args": [
3 + [
4 + {
5 + "raw": "dom-serializer@~0.1.0",
6 + "scope": null,
7 + "escapedName": "dom-serializer",
8 + "name": "dom-serializer",
9 + "rawSpec": "~0.1.0",
10 + "spec": ">=0.1.0 <0.2.0",
11 + "type": "range"
12 + },
13 + "C:\\Users\\hyshs\\Desktop\\OSS_Project\\node_modules\\cheerio"
14 + ]
15 + ],
16 + "_from": "dom-serializer@>=0.1.0 <0.2.0",
17 + "_id": "dom-serializer@0.1.0",
18 + "_inCache": true,
19 + "_location": "/dom-serializer",
20 + "_nodeVersion": "1.2.0",
21 + "_npmUser": {
22 + "name": "feedic",
23 + "email": "me@feedic.com"
24 + },
25 + "_npmVersion": "2.4.1",
26 + "_phantomChildren": {},
27 + "_requested": {
28 + "raw": "dom-serializer@~0.1.0",
29 + "scope": null,
30 + "escapedName": "dom-serializer",
31 + "name": "dom-serializer",
32 + "rawSpec": "~0.1.0",
33 + "spec": ">=0.1.0 <0.2.0",
34 + "type": "range"
35 + },
36 + "_requiredBy": [
37 + "/cheerio",
38 + "/domutils"
39 + ],
40 + "_resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz",
41 + "_shasum": "073c697546ce0780ce23be4a28e293e40bc30c82",
42 + "_shrinkwrap": null,
43 + "_spec": "dom-serializer@~0.1.0",
44 + "_where": "C:\\Users\\hyshs\\Desktop\\OSS_Project\\node_modules\\cheerio",
45 + "author": {
46 + "name": "Felix Boehm",
47 + "email": "me@feedic.com"
48 + },
49 + "bugs": {
50 + "url": "https://github.com/cheeriojs/dom-renderer/issues"
51 + },
52 + "dependencies": {
53 + "domelementtype": "~1.1.1",
54 + "entities": "~1.1.1"
55 + },
56 + "description": "render dom nodes to string",
57 + "devDependencies": {
58 + "cheerio": "*",
59 + "expect.js": "~0.3.1",
60 + "jshint": "~2.3.0",
61 + "lodash": "~2.4.1",
62 + "mocha": "*",
63 + "xyz": "0.4.x"
64 + },
65 + "directories": {},
66 + "dist": {
67 + "shasum": "073c697546ce0780ce23be4a28e293e40bc30c82",
68 + "tarball": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz"
69 + },
70 + "files": [
71 + "index.js"
72 + ],
73 + "gitHead": "249b9a921e6ba318c52b87de21e8475bcb4050e5",
74 + "homepage": "https://github.com/cheeriojs/dom-renderer",
75 + "keywords": [
76 + "html",
77 + "xml",
78 + "render"
79 + ],
80 + "license": "MIT",
81 + "main": "./index.js",
82 + "maintainers": [
83 + {
84 + "name": "feedic",
85 + "email": "me@feedic.com"
86 + },
87 + {
88 + "name": "davidchambers",
89 + "email": "dc@davidchambers.me"
90 + },
91 + {
92 + "name": "mattmueller",
93 + "email": "mattmuelle@gmail.com"
94 + }
95 + ],
96 + "name": "dom-serializer",
97 + "optionalDependencies": {},
98 + "readme": "ERROR: No README data found!",
99 + "repository": {
100 + "type": "git",
101 + "url": "git://github.com/cheeriojs/dom-renderer.git"
102 + },
103 + "scripts": {
104 + "test": "mocha test.js"
105 + },
106 + "version": "0.1.0"
107 +}
1 +Copyright (c) Felix Böhm
2 +All rights reserved.
3 +
4 +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5 +
6 +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7 +
8 +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 +
10 +THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
11 +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1 +//Types of elements found in the DOM
2 +module.exports = {
3 + Text: "text", //Text
4 + Directive: "directive", //<? ... ?>
5 + Comment: "comment", //<!-- ... -->
6 + Script: "script", //<script> tags
7 + Style: "style", //<style> tags
8 + Tag: "tag", //Any tag
9 + CDATA: "cdata", //<![CDATA[ ... ]]>
10 + Doctype: "doctype",
11 +
12 + isTag: function(elem){
13 + return elem.type === "tag" || elem.type === "script" || elem.type === "style";
14 + }
15 +};
1 +{
2 + "_args": [
3 + [
4 + {
5 + "raw": "domelementtype@1",
6 + "scope": null,
7 + "escapedName": "domelementtype",
8 + "name": "domelementtype",
9 + "rawSpec": "1",
10 + "spec": ">=1.0.0 <2.0.0",
11 + "type": "range"
12 + },
13 + "C:\\Users\\hyshs\\Desktop\\OSS_Project\\node_modules\\domutils"
14 + ]
15 + ],
16 + "_from": "domelementtype@>=1.0.0 <2.0.0",
17 + "_id": "domelementtype@1.3.0",
18 + "_inCache": true,
19 + "_location": "/domelementtype",
20 + "_nodeVersion": "1.4.2",
21 + "_npmUser": {
22 + "name": "feedic",
23 + "email": "me@feedic.com"
24 + },
25 + "_npmVersion": "2.6.1",
26 + "_phantomChildren": {},
27 + "_requested": {
28 + "raw": "domelementtype@1",
29 + "scope": null,
30 + "escapedName": "domelementtype",
31 + "name": "domelementtype",
32 + "rawSpec": "1",
33 + "spec": ">=1.0.0 <2.0.0",
34 + "type": "range"
35 + },
36 + "_requiredBy": [
37 + "/domhandler",
38 + "/domutils",
39 + "/htmlparser2"
40 + ],
41 + "_resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.0.tgz",
42 + "_shasum": "b17aed82e8ab59e52dd9c19b1756e0fc187204c2",
43 + "_shrinkwrap": null,
44 + "_spec": "domelementtype@1",
45 + "_where": "C:\\Users\\hyshs\\Desktop\\OSS_Project\\node_modules\\domutils",
46 + "author": {
47 + "name": "Felix Boehm",
48 + "email": "me@feedic.com"
49 + },
50 + "bugs": {
51 + "url": "https://github.com/FB55/domelementtype/issues"
52 + },
53 + "dependencies": {},
54 + "description": "all the types of nodes in htmlparser2's dom",
55 + "devDependencies": {},
56 + "directories": {},
57 + "dist": {
58 + "shasum": "b17aed82e8ab59e52dd9c19b1756e0fc187204c2",
59 + "tarball": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.0.tgz"
60 + },
61 + "gitHead": "2a95eed4c829ef479a88984d117cb5f4b379e6e8",
62 + "homepage": "https://github.com/FB55/domelementtype",
63 + "keywords": [
64 + "dom",
65 + "htmlparser2"
66 + ],
67 + "main": "index.js",
68 + "maintainers": [
69 + {
70 + "name": "feedic",
71 + "email": "me@feedic.com"
72 + }
73 + ],
74 + "name": "domelementtype",
75 + "optionalDependencies": {},
76 + "readme": "ERROR: No README data found!",
77 + "repository": {
78 + "type": "git",
79 + "url": "git://github.com/FB55/domelementtype.git"
80 + },
81 + "scripts": {},
82 + "version": "1.3.0"
83 +}
1 +all the types of nodes in htmlparser2's dom
1 +before_install:
2 + - '[ "${TRAVIS_NODE_VERSION}" != "0.8" ] || npm install -g npm@1.4.28'
3 + - npm install -g npm@latest
4 +language: node_js
5 +node_js:
6 + - 0.8
7 + - 0.10
1 +Copyright (c) Felix Böhm
2 +All rights reserved.
3 +
4 +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5 +
6 +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7 +
8 +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 +
10 +THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
11 +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1 +var ElementType = require("domelementtype");
2 +
3 +var re_whitespace = /\s+/g;
4 +var NodePrototype = require("./lib/node");
5 +var ElementPrototype = require("./lib/element");
6 +
7 +function DomHandler(callback, options, elementCB){
8 + if(typeof callback === "object"){
9 + elementCB = options;
10 + options = callback;
11 + callback = null;
12 + } else if(typeof options === "function"){
13 + elementCB = options;
14 + options = defaultOpts;
15 + }
16 + this._callback = callback;
17 + this._options = options || defaultOpts;
18 + this._elementCB = elementCB;
19 + this.dom = [];
20 + this._done = false;
21 + this._tagStack = [];
22 + this._parser = this._parser || null;
23 +}
24 +
25 +//default options
26 +var defaultOpts = {
27 + normalizeWhitespace: false, //Replace all whitespace with single spaces
28 + withStartIndices: false, //Add startIndex properties to nodes
29 + withEndIndices: false, //Add endIndex properties to nodes
30 +};
31 +
32 +DomHandler.prototype.onparserinit = function(parser){
33 + this._parser = parser;
34 +};
35 +
36 +//Resets the handler back to starting state
37 +DomHandler.prototype.onreset = function(){
38 + DomHandler.call(this, this._callback, this._options, this._elementCB);
39 +};
40 +
41 +//Signals the handler that parsing is done
42 +DomHandler.prototype.onend = function(){
43 + if(this._done) return;
44 + this._done = true;
45 + this._parser = null;
46 + this._handleCallback(null);
47 +};
48 +
49 +DomHandler.prototype._handleCallback =
50 +DomHandler.prototype.onerror = function(error){
51 + if(typeof this._callback === "function"){
52 + this._callback(error, this.dom);
53 + } else {
54 + if(error) throw error;
55 + }
56 +};
57 +
58 +DomHandler.prototype.onclosetag = function(){
59 + //if(this._tagStack.pop().name !== name) this._handleCallback(Error("Tagname didn't match!"));
60 +
61 + var elem = this._tagStack.pop();
62 +
63 + if(this._options.withEndIndices){
64 + elem.endIndex = this._parser.endIndex;
65 + }
66 +
67 + if(this._elementCB) this._elementCB(elem);
68 +};
69 +
70 +DomHandler.prototype._createDomElement = function(properties){
71 + if (!this._options.withDomLvl1) return properties;
72 +
73 + var element;
74 + if (properties.type === "tag") {
75 + element = Object.create(ElementPrototype);
76 + } else {
77 + element = Object.create(NodePrototype);
78 + }
79 +
80 + for (var key in properties) {
81 + if (properties.hasOwnProperty(key)) {
82 + element[key] = properties[key];
83 + }
84 + }
85 +
86 + return element;
87 +};
88 +
89 +DomHandler.prototype._addDomElement = function(element){
90 + var parent = this._tagStack[this._tagStack.length - 1];
91 + var siblings = parent ? parent.children : this.dom;
92 + var previousSibling = siblings[siblings.length - 1];
93 +
94 + element.next = null;
95 +
96 + if(this._options.withStartIndices){
97 + element.startIndex = this._parser.startIndex;
98 + }
99 + if(this._options.withEndIndices){
100 + element.endIndex = this._parser.endIndex;
101 + }
102 +
103 + if(previousSibling){
104 + element.prev = previousSibling;
105 + previousSibling.next = element;
106 + } else {
107 + element.prev = null;
108 + }
109 +
110 + siblings.push(element);
111 + element.parent = parent || null;
112 +};
113 +
114 +DomHandler.prototype.onopentag = function(name, attribs){
115 + var properties = {
116 + type: name === "script" ? ElementType.Script : name === "style" ? ElementType.Style : ElementType.Tag,
117 + name: name,
118 + attribs: attribs,
119 + children: []
120 + };
121 +
122 + var element = this._createDomElement(properties);
123 +
124 + this._addDomElement(element);
125 +
126 + this._tagStack.push(element);
127 +};
128 +
129 +DomHandler.prototype.ontext = function(data){
130 + //the ignoreWhitespace is officially dropped, but for now,
131 + //it's an alias for normalizeWhitespace
132 + var normalize = this._options.normalizeWhitespace || this._options.ignoreWhitespace;
133 +
134 + var lastTag;
135 +
136 + if(!this._tagStack.length && this.dom.length && (lastTag = this.dom[this.dom.length-1]).type === ElementType.Text){
137 + if(normalize){
138 + lastTag.data = (lastTag.data + data).replace(re_whitespace, " ");
139 + } else {
140 + lastTag.data += data;
141 + }
142 + } else {
143 + if(
144 + this._tagStack.length &&
145 + (lastTag = this._tagStack[this._tagStack.length - 1]) &&
146 + (lastTag = lastTag.children[lastTag.children.length - 1]) &&
147 + lastTag.type === ElementType.Text
148 + ){
149 + if(normalize){
150 + lastTag.data = (lastTag.data + data).replace(re_whitespace, " ");
151 + } else {
152 + lastTag.data += data;
153 + }
154 + } else {
155 + if(normalize){
156 + data = data.replace(re_whitespace, " ");
157 + }
158 +
159 + var element = this._createDomElement({
160 + data: data,
161 + type: ElementType.Text
162 + });
163 +
164 + this._addDomElement(element);
165 + }
166 + }
167 +};
168 +
169 +DomHandler.prototype.oncomment = function(data){
170 + var lastTag = this._tagStack[this._tagStack.length - 1];
171 +
172 + if(lastTag && lastTag.type === ElementType.Comment){
173 + lastTag.data += data;
174 + return;
175 + }
176 +
177 + var properties = {
178 + data: data,
179 + type: ElementType.Comment
180 + };
181 +
182 + var element = this._createDomElement(properties);
183 +
184 + this._addDomElement(element);
185 + this._tagStack.push(element);
186 +};
187 +
188 +DomHandler.prototype.oncdatastart = function(){
189 + var properties = {
190 + children: [{
191 + data: "",
192 + type: ElementType.Text
193 + }],
194 + type: ElementType.CDATA
195 + };
196 +
197 + var element = this._createDomElement(properties);
198 +
199 + this._addDomElement(element);
200 + this._tagStack.push(element);
201 +};
202 +
203 +DomHandler.prototype.oncommentend = DomHandler.prototype.oncdataend = function(){
204 + this._tagStack.pop();
205 +};
206 +
207 +DomHandler.prototype.onprocessinginstruction = function(name, data){
208 + var element = this._createDomElement({
209 + name: name,
210 + data: data,
211 + type: ElementType.Directive
212 + });
213 +
214 + this._addDomElement(element);
215 +};
216 +
217 +module.exports = DomHandler;
1 +// DOM-Level-1-compliant structure
2 +var NodePrototype = require('./node');
3 +var ElementPrototype = module.exports = Object.create(NodePrototype);
4 +
5 +var domLvl1 = {
6 + tagName: "name"
7 +};
8 +
9 +Object.keys(domLvl1).forEach(function(key) {
10 + var shorthand = domLvl1[key];
11 + Object.defineProperty(ElementPrototype, key, {
12 + get: function() {
13 + return this[shorthand] || null;
14 + },
15 + set: function(val) {
16 + this[shorthand] = val;
17 + return val;
18 + }
19 + });
20 +});
1 +// This object will be used as the prototype for Nodes when creating a
2 +// DOM-Level-1-compliant structure.
3 +var NodePrototype = module.exports = {
4 + get firstChild() {
5 + var children = this.children;
6 + return children && children[0] || null;
7 + },
8 + get lastChild() {
9 + var children = this.children;
10 + return children && children[children.length - 1] || null;
11 + },
12 + get nodeType() {
13 + return nodeTypes[this.type] || nodeTypes.element;
14 + }
15 +};
16 +
17 +var domLvl1 = {
18 + tagName: "name",
19 + childNodes: "children",
20 + parentNode: "parent",
21 + previousSibling: "prev",
22 + nextSibling: "next",
23 + nodeValue: "data"
24 +};
25 +
26 +var nodeTypes = {
27 + element: 1,
28 + text: 3,
29 + cdata: 4,
30 + comment: 8
31 +};
32 +
33 +Object.keys(domLvl1).forEach(function(key) {
34 + var shorthand = domLvl1[key];
35 + Object.defineProperty(NodePrototype, key, {
36 + get: function() {
37 + return this[shorthand] || null;
38 + },
39 + set: function(val) {
40 + this[shorthand] = val;
41 + return val;
42 + }
43 + });
44 +});
1 +{
2 + "_args": [
3 + [
4 + {
5 + "raw": "domhandler@^2.3.0",
6 + "scope": null,
7 + "escapedName": "domhandler",
8 + "name": "domhandler",
9 + "rawSpec": "^2.3.0",
10 + "spec": ">=2.3.0 <3.0.0",
11 + "type": "range"
12 + },
13 + "C:\\Users\\hyshs\\Desktop\\OSS_Project\\node_modules\\htmlparser2"
14 + ]
15 + ],
16 + "_from": "domhandler@>=2.3.0 <3.0.0",
17 + "_id": "domhandler@2.4.1",
18 + "_inCache": true,
19 + "_location": "/domhandler",
20 + "_nodeVersion": "7.9.0",
21 + "_npmOperationalInternal": {
22 + "host": "packages-12-west.internal.npmjs.com",
23 + "tmp": "tmp/domhandler-2.4.1.tgz_1494125946418_0.981079070828855"
24 + },
25 + "_npmUser": {
26 + "name": "feedic",
27 + "email": "me@feedic.com"
28 + },
29 + "_npmVersion": "4.6.1",
30 + "_phantomChildren": {},
31 + "_requested": {
32 + "raw": "domhandler@^2.3.0",
33 + "scope": null,
34 + "escapedName": "domhandler",
35 + "name": "domhandler",
36 + "rawSpec": "^2.3.0",
37 + "spec": ">=2.3.0 <3.0.0",
38 + "type": "range"
39 + },
40 + "_requiredBy": [
41 + "/htmlparser2"
42 + ],
43 + "_resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.1.tgz",
44 + "_shasum": "892e47000a99be55bbf3774ffea0561d8879c259",
45 + "_shrinkwrap": null,
46 + "_spec": "domhandler@^2.3.0",
47 + "_where": "C:\\Users\\hyshs\\Desktop\\OSS_Project\\node_modules\\htmlparser2",
48 + "author": {
49 + "name": "Felix Boehm",
50 + "email": "me@feedic.com"
51 + },
52 + "bugs": {
53 + "url": "https://github.com/fb55/DomHandler/issues"
54 + },
55 + "dependencies": {
56 + "domelementtype": "1"
57 + },
58 + "description": "handler for htmlparser2 that turns pages into a dom",
59 + "devDependencies": {
60 + "htmlparser2": "^3.9.0",
61 + "jshint": "^2.9.1",
62 + "mocha": "^3.0.2"
63 + },
64 + "directories": {
65 + "test": "tests"
66 + },
67 + "dist": {
68 + "shasum": "892e47000a99be55bbf3774ffea0561d8879c259",
69 + "tarball": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.1.tgz"
70 + },
71 + "gitHead": "9b17cc6cc9387a87dde6eb8ddbae11c753e7d23d",
72 + "homepage": "https://github.com/fb55/DomHandler#readme",
73 + "jshintConfig": {
74 + "quotmark": "double",
75 + "trailing": true,
76 + "unused": true,
77 + "undef": true,
78 + "node": true,
79 + "proto": true,
80 + "globals": {
81 + "it": true
82 + }
83 + },
84 + "keywords": [
85 + "dom",
86 + "htmlparser2"
87 + ],
88 + "license": "BSD-2-Clause",
89 + "main": "index.js",
90 + "maintainers": [
91 + {
92 + "name": "feedic",
93 + "email": "me@feedic.com"
94 + }
95 + ],
96 + "name": "domhandler",
97 + "optionalDependencies": {},
98 + "readme": "ERROR: No README data found!",
99 + "repository": {
100 + "type": "git",
101 + "url": "git://github.com/fb55/DomHandler.git"
102 + },
103 + "scripts": {
104 + "test": "mocha -R list && jshint index.js test/"
105 + },
106 + "version": "2.4.1"
107 +}
1 +# domhandler [![Build Status](https://travis-ci.org/fb55/domhandler.svg?branch=master)](https://travis-ci.org/fb55/domhandler)
2 +
3 +The DOM handler (formally known as DefaultHandler) creates a tree containing all nodes of a page. The tree may be manipulated using the [domutils](https://github.com/fb55/domutils) library.
4 +
5 +## Usage
6 +```javascript
7 +var handler = new DomHandler([ <func> callback(err, dom), ] [ <obj> options ]);
8 +// var parser = new Parser(handler[, options]);
9 +```
10 +
11 +Available options are described below.
12 +
13 +## Example
14 +```javascript
15 +var htmlparser = require("htmlparser2");
16 +var rawHtml = "Xyz <script language= javascript>var foo = '<<bar>>';< / script><!--<!-- Waah! -- -->";
17 +var handler = new htmlparser.DomHandler(function (error, dom) {
18 + if (error)
19 + [...do something for errors...]
20 + else
21 + [...parsing done, do something...]
22 + console.log(dom);
23 +});
24 +var parser = new htmlparser.Parser(handler);
25 +parser.write(rawHtml);
26 +parser.end();
27 +```
28 +
29 +Output:
30 +
31 +```javascript
32 +[{
33 + data: 'Xyz ',
34 + type: 'text'
35 +}, {
36 + type: 'script',
37 + name: 'script',
38 + attribs: {
39 + language: 'javascript'
40 + },
41 + children: [{
42 + data: 'var foo = \'<bar>\';<',
43 + type: 'text'
44 + }]
45 +}, {
46 + data: '<!-- Waah! -- ',
47 + type: 'comment'
48 +}]
49 +```
50 +
51 +## Option: normalizeWhitespace
52 +Indicates whether the whitespace in text nodes should be normalized (= all whitespace should be replaced with single spaces). The default value is "false".
53 +
54 +The following HTML will be used:
55 +
56 +```html
57 +<font>
58 + <br>this is the text
59 +<font>
60 +```
61 +
62 +### Example: true
63 +
64 +```javascript
65 +[{
66 + type: 'tag',
67 + name: 'font',
68 + children: [{
69 + data: ' ',
70 + type: 'text'
71 + }, {
72 + type: 'tag',
73 + name: 'br'
74 + }, {
75 + data: 'this is the text ',
76 + type: 'text'
77 + }, {
78 + type: 'tag',
79 + name: 'font'
80 + }]
81 +}]
82 +```
83 +
84 +### Example: false
85 +
86 +```javascript
87 +[{
88 + type: 'tag',
89 + name: 'font',
90 + children: [{
91 + data: '\n\t',
92 + type: 'text'
93 + }, {
94 + type: 'tag',
95 + name: 'br'
96 + }, {
97 + data: 'this is the text\n',
98 + type: 'text'
99 + }, {
100 + type: 'tag',
101 + name: 'font'
102 + }]
103 +}]
104 +```
105 +
106 +## Option: withDomLvl1
107 +
108 +Adds DOM level 1 properties to all elements.
109 +
110 +<!-- TODO: description -->
111 +
112 +## Option: withStartIndices
113 +Indicates whether a `startIndex` property will be added to nodes. When the parser is used in a non-streaming fashion, `startIndex` is an integer indicating the position of the start of the node in the document. The default value is "false".
114 +
115 +## Option: withEndIndices
116 +Indicates whether a `endIndex` property will be added to nodes. When the parser is used in a non-streaming fashion, `endIndex` is an integer indicating the position of the end of the node in the document. The default value is "false".
1 +{
2 + "name": "Basic test",
3 + "options": {},
4 + "html": "<!DOCTYPE html><html><title>The Title</title><body>Hello world</body></html>",
5 + "expected": [
6 + {
7 + "name": "!doctype",
8 + "data": "!DOCTYPE html",
9 + "type": "directive"
10 + },
11 + {
12 + "type": "tag",
13 + "name": "html",
14 + "attribs": {},
15 + "parent": null,
16 + "children": [
17 + {
18 + "type": "tag",
19 + "name": "title",
20 + "attribs": {},
21 + "parent": {
22 + "type": "tag",
23 + "name": "html",
24 + "attribs": {}
25 + },
26 + "children": [
27 + {
28 + "data": "The Title",
29 + "type": "text",
30 + "parent": {
31 + "type": "tag",
32 + "name": "title",
33 + "attribs": {}
34 + }
35 + }
36 + ]
37 + },
38 + {
39 + "type": "tag",
40 + "name": "body",
41 + "attribs": {},
42 + "children": [
43 + {
44 + "data": "Hello world",
45 + "type": "text"
46 + }
47 + ],
48 + "prev": {
49 + "type": "tag",
50 + "name": "title",
51 + "attribs": {}
52 + }
53 + }
54 + ]
55 + }
56 + ]
57 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "name": "Single Tag 1",
3 + "options": {},
4 + "html": "<br>text</br>",
5 + "expected": [
6 + {
7 + "type": "tag",
8 + "name": "br",
9 + "attribs": {}
10 + },
11 + {
12 + "data": "text",
13 + "type": "text"
14 + },
15 + {
16 + "type": "tag",
17 + "name": "br",
18 + "attribs": {}
19 + }
20 + ]
21 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "name": "Single Tag 2",
3 + "options": {},
4 + "html": "<br>text<br>",
5 + "expected": [
6 + {
7 + "type": "tag",
8 + "name": "br",
9 + "attribs": {}
10 + },
11 + {
12 + "data": "text",
13 + "type": "text"
14 + },
15 + {
16 + "type": "tag",
17 + "name": "br",
18 + "attribs": {}
19 + }
20 + ]
21 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "name": "Unescaped chars in script",
3 + "options": {},
4 + "html": "<head><script language=\"Javascript\">var foo = \"<bar>\"; alert(2 > foo); var baz = 10 << 2; var zip = 10 >> 1; var yap = \"<<>>>><<\";</script></head>",
5 + "expected": [
6 + {
7 + "type": "tag",
8 + "name": "head",
9 + "attribs": {},
10 + "children": [
11 + {
12 + "type": "script",
13 + "name": "script",
14 + "attribs": {
15 + "language": "Javascript"
16 + },
17 + "children": [
18 + {
19 + "data": "var foo = \"<bar>\"; alert(2 > foo); var baz = 10 << 2; var zip = 10 >> 1; var yap = \"<<>>>><<\";",
20 + "type": "text"
21 + }
22 + ]
23 + }
24 + ]
25 + }
26 + ]
27 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "name": "Special char in comment",
3 + "options": {},
4 + "html": "<head><!-- commented out tags <title>Test</title>--></head>",
5 + "expected": [
6 + {
7 + "type": "tag",
8 + "name": "head",
9 + "attribs": {},
10 + "children": [
11 + {
12 + "data": " commented out tags <title>Test</title>",
13 + "type": "comment"
14 + }
15 + ]
16 + }
17 + ]
18 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "name": "Script source in comment",
3 + "options": {},
4 + "html": "<script><!--var foo = 1;--></script>",
5 + "expected": [
6 + {
7 + "type": "script",
8 + "name": "script",
9 + "attribs": {},
10 + "children": [
11 + {
12 + "data": "<!--var foo = 1;-->",
13 + "type": "text"
14 + }
15 + ]
16 + }
17 + ]
18 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "name": "Unescaped chars in style",
3 + "options": {},
4 + "html": "<style type=\"text/css\">\n body > p\n\t{ font-weight: bold; }</style>",
5 + "expected": [
6 + {
7 + "type": "style",
8 + "name": "style",
9 + "attribs": {
10 + "type": "text/css"
11 + },
12 + "children": [
13 + {
14 + "data": "\n body > p\n\t{ font-weight: bold; }",
15 + "type": "text"
16 + }
17 + ]
18 + }
19 + ]
20 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "name": "Extra spaces in tag",
3 + "options": {},
4 + "html": "<font\t\n size='14' \n>the text</\t\nfont\t \n>",
5 + "expected": [
6 + {
7 + "type": "tag",
8 + "name": "font",
9 + "attribs": {
10 + "size": "14"
11 + },
12 + "children": [
13 + {
14 + "data": "the text",
15 + "type": "text"
16 + }
17 + ]
18 + }
19 + ]
20 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "name": "Unquoted attributes",
3 + "options": {},
4 + "html": "<font size= 14>the text</font>",
5 + "expected": [
6 + {
7 + "type": "tag",
8 + "name": "font",
9 + "attribs": {
10 + "size": "14"
11 + },
12 + "children": [
13 + {
14 + "data": "the text",
15 + "type": "text"
16 + }
17 + ]
18 + }
19 + ]
20 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "name": "Singular attribute",
3 + "options": {},
4 + "html": "<option value='foo' selected>",
5 + "expected": [
6 + {
7 + "type": "tag",
8 + "name": "option",
9 + "attribs": {
10 + "value": "foo",
11 + "selected": ""
12 + }
13 + }
14 + ]
15 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "name": "Text outside tags",
3 + "options": {},
4 + "html": "Line one\n<br>\nline two",
5 + "expected": [
6 + {
7 + "data": "Line one\n",
8 + "type": "text",
9 + "prev": null,
10 + "next": {
11 + "type": "tag",
12 + "name": "br",
13 + "attribs": {}
14 + }
15 + },
16 + {
17 + "type": "tag",
18 + "name": "br",
19 + "attribs": {},
20 + "prev": {
21 + "data": "Line one\n",
22 + "type": "text"
23 + },
24 + "next": {
25 + "data": "\nline two",
26 + "type": "text"
27 + }
28 + },
29 + {
30 + "data": "\nline two",
31 + "type": "text",
32 + "prev": {
33 + "type": "tag",
34 + "name": "br",
35 + "attribs": {}
36 + },
37 + "next": null
38 + }
39 + ]
40 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "name": "Only text",
3 + "options": {},
4 + "html": "this is the text",
5 + "expected": [
6 + {
7 + "data": "this is the text",
8 + "type": "text"
9 + }
10 + ]
11 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "name": "Comment within text",
3 + "options": {},
4 + "html": "this is <!-- the comment --> the text",
5 + "expected": [
6 + {
7 + "data": "this is ",
8 + "type": "text"
9 + },
10 + {
11 + "data": " the comment ",
12 + "type": "comment"
13 + },
14 + {
15 + "data": " the text",
16 + "type": "text"
17 + }
18 + ]
19 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "name": "Comment within text within script",
3 + "options": {},
4 + "html": "<script>this is <!-- the comment --> the text</script>",
5 + "expected": [
6 + {
7 + "type": "script",
8 + "name": "script",
9 + "attribs": {},
10 + "children": [
11 + {
12 + "data": "this is <!-- the comment --> the text",
13 + "type": "text"
14 + }
15 + ]
16 + }
17 + ]
18 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "name": "Option 'verbose' set to 'false'",
3 + "options": {
4 + "verbose": false
5 + },
6 + "html": "<font\t\n size='14' \n>the text</\t\nfont\t \n>",
7 + "expected": [
8 + {
9 + "type": "tag",
10 + "name": "font",
11 + "attribs": {
12 + "size": "14"
13 + },
14 + "children": [
15 + {
16 + "data": "the text",
17 + "type": "text"
18 + }
19 + ]
20 + }
21 + ]
22 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "name": "Normalize whitespace",
3 + "options": {
4 + "normalizeWhitespace": true
5 + },
6 + "html": "Line one\n<br>\t \r\n\f <br>\nline two<font><br> x </font>",
7 + "expected": [
8 + {
9 + "data": "Line one ",
10 + "type": "text"
11 + },
12 + {
13 + "type": "tag",
14 + "name": "br",
15 + "attribs": {}
16 + },
17 + {
18 + "data": " ",
19 + "type": "text"
20 + },
21 + {
22 + "type": "tag",
23 + "name": "br",
24 + "attribs": {}
25 + },
26 + {
27 + "data": " line two",
28 + "type": "text"
29 + },
30 + {
31 + "type": "tag",
32 + "name": "font",
33 + "attribs": {},
34 + "children": [
35 + {
36 + "type": "tag",
37 + "name": "br",
38 + "attribs": {}
39 + },
40 + {
41 + "data": " x ",
42 + "type": "text"
43 + }
44 + ]
45 + }
46 + ]
47 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "name": "XML Namespace",
3 + "options": {},
4 + "html": "<ns:tag>text</ns:tag>",
5 + "expected": [
6 + {
7 + "type": "tag",
8 + "name": "ns:tag",
9 + "attribs": {},
10 + "children": [
11 + {
12 + "data": "text",
13 + "type": "text"
14 + }
15 + ]
16 + }
17 + ]
18 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "name": "Enforce empty tags",
3 + "options": {},
4 + "html": "<link>text</link>",
5 + "expected": [
6 + {
7 + "type": "tag",
8 + "name": "link",
9 + "attribs": {}
10 + },
11 + {
12 + "data": "text",
13 + "type": "text"
14 + }
15 + ]
16 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "name": "Ignore empty tags (xml mode)",
3 + "options": {
4 + "xmlMode": true
5 + },
6 + "html": "<link>text</link>",
7 + "expected": [
8 + {
9 + "type": "tag",
10 + "name": "link",
11 + "attribs": {},
12 + "children": [
13 + {
14 + "data": "text",
15 + "type": "text"
16 + }
17 + ]
18 + }
19 + ]
20 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "name": "Template script tags",
3 + "options": {},
4 + "html": "<script type=\"text/template\"><h1>Heading1</h1></script>",
5 + "expected": [
6 + {
7 + "type": "script",
8 + "name": "script",
9 + "attribs": {
10 + "type": "text/template"
11 + },
12 + "children": [
13 + {
14 + "data": "<h1>Heading1</h1>",
15 + "type": "text"
16 + }
17 + ]
18 + }
19 + ]
20 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "name": "Conditional comments",
3 + "options": {},
4 + "html": "<!--[if lt IE 7]> <html class='no-js ie6 oldie' lang='en'> <![endif]--><!--[if lt IE 7]> <html class='no-js ie6 oldie' lang='en'> <![endif]-->",
5 + "expected": [
6 + {
7 + "data": "[if lt IE 7]> <html class='no-js ie6 oldie' lang='en'> <![endif]",
8 + "type": "comment"
9 + },
10 + {
11 + "data": "[if lt IE 7]> <html class='no-js ie6 oldie' lang='en'> <![endif]",
12 + "type": "comment"
13 + }
14 + ]
15 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "name": "lowercase tags",
3 + "options": {},
4 + "html": "<!DOCTYPE html><HTML><TITLE>The Title</title><BODY>Hello world</body></html>",
5 + "expected": [
6 + {
7 + "name": "!doctype",
8 + "data": "!DOCTYPE html",
9 + "type": "directive"
10 + },
11 + {
12 + "type": "tag",
13 + "name": "html",
14 + "attribs": {},
15 + "children": [
16 + {
17 + "type": "tag",
18 + "name": "title",
19 + "attribs": {},
20 + "children": [
21 + {
22 + "data": "The Title",
23 + "type": "text"
24 + }
25 + ]
26 + },
27 + {
28 + "type": "tag",
29 + "name": "body",
30 + "attribs": {},
31 + "children": [
32 + {
33 + "data": "Hello world",
34 + "type": "text"
35 + }
36 + ]
37 + }
38 + ]
39 + }
40 + ]
41 +}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "name": "DOM level 1",
3 + "options": { "withDomLvl1": true },
4 + "html": "<div>some stray text<h1>Hello, world.</h1><!-- comment node -->more stray text</div>",
5 + "expected": [
6 + {
7 + "type": "tag",
8 + "nodeType": 1,
9 + "name": "div",
10 + "tagName": "div",
11 + "attribs": {},
12 + "nodeValue": null,
13 + "children": [
14 + {
15 + "type": "text",
16 + "nodeType": 3,
17 + "tagName": null,
18 + "data": "some stray text",
19 + "nodeValue": "some stray text",
20 + "childNodes": null,
21 + "firstChild": null,
22 + "lastChild": null
23 + },
24 + {
25 + "type": "tag",
26 + "nodeType": 1,
27 + "name": "h1",
28 + "tagName": "h1",
29 + "nodeValue": null,
30 + "attribs": {},
31 + "children": [
32 + {
33 + "type": "text",
34 + "nodeType": 3,
35 + "tagName": null,
36 + "data": "Hello, world.",
37 + "nodeValue": "Hello, world.",
38 + "childNodes": null,
39 + "firstChild": null,
40 + "lastChild": null
41 + }
42 + ],
43 + "firstChild": {
44 + "type": "text",
45 + "nodeType": 3,
46 + "tagName": null,
47 + "data": "Hello, world.",
48 + "nodeValue": "Hello, world.",
49 + "childNodes": null,
50 + "firstChild": null,
51 + "lastChild": null
52 + },
53 + "lastChild": {
54 + "type": "text",
55 + "nodeType": 3,
56 + "tagName": null,
57 + "data": "Hello, world.",
58 + "nodeValue": "Hello, world.",
59 + "childNodes": null,
60 + "firstChild": null,
61 + "lastChild": null
62 + }
63 + },
64 + {
65 + "type": "comment",
66 + "nodeType": 8,
67 + "tagName": null,
68 + "data": " comment node ",
69 + "nodeValue": " comment node ",
70 + "childNodes": null,
71 + "firstChild": null,
72 + "lastChild": null,
73 + "prev": {
74 + "type": "tag",
75 + "name": "h1",
76 + "nodeValue": null,
77 + "attribs": {}
78 + },
79 + "previousSibling": {
80 + "type": "tag",
81 + "name": "h1",
82 + "nodeValue": null,
83 + "attribs": {}
84 + },
85 + "next": {
86 + "type": "text",
87 + "tagName": null,
88 + "data": "more stray text"
89 + },
90 + "nextSibling": {
91 + "type": "text",
92 + "tagName": null,
93 + "data": "more stray text"
94 + }
95 + },
96 + {
97 + "type": "text",
98 + "nodeType": 3,
99 + "tagName": null,
100 + "data": "more stray text",
101 + "nodeValue": "more stray text",
102 + "childNodes": null,
103 + "firstChild": null,
104 + "lastChild": null,
105 + "next": null,
106 + "nextSibling": null
107 + }
108 + ],
109 + "firstChild": {
110 + "type": "text",
111 + "nodeType": 3,
112 + "tagName": null,
113 + "data": "some stray text",
114 + "nodeValue": "some stray text",
115 + "childNodes": null,
116 + "firstChild": null,
117 + "lastChild": null
118 + },
119 + "lastChild": {
120 + "type": "text",
121 + "nodeType": 3,
122 + "tagName": null,
123 + "data": "more stray text",
124 + "nodeValue": "more stray text",
125 + "childNodes": null,
126 + "firstChild": null,
127 + "lastChild": null
128 + }
129 + }
130 + ]
131 +}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.