rahad-media-downloader 2.1.8 → 2.1.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. package/.cache/replit/modules/{nodejs-20:v32-20240401-269b323.res → nodejs-20:v36-20240502-f4453db.res} +1 -1
  2. package/.cache/replit/modules/{replit:v8-20240329-787bc7d.res → replit:v9-20240429-0325cbb.res} +1 -1
  3. package/.cache/typescript/5.3/node_modules/.package-lock.json +60 -0
  4. package/.cache/typescript/5.3/node_modules/@types/cookie/LICENSE +21 -0
  5. package/.cache/typescript/5.3/node_modules/@types/cookie/README.md +15 -0
  6. package/.cache/typescript/5.3/node_modules/@types/cookie/index.d.ts +154 -0
  7. package/.cache/typescript/5.3/node_modules/@types/cookie/package.json +30 -0
  8. package/.cache/typescript/5.3/node_modules/@types/domhandler/LICENSE +21 -0
  9. package/.cache/typescript/5.3/node_modules/@types/domhandler/README.md +92 -0
  10. package/.cache/typescript/5.3/node_modules/@types/domhandler/index.d.ts +73 -0
  11. package/.cache/typescript/5.3/node_modules/@types/domhandler/package.json +25 -0
  12. package/.cache/typescript/5.3/node_modules/@types/domutils/LICENSE +21 -0
  13. package/.cache/typescript/5.3/node_modules/@types/domutils/README.md +15 -0
  14. package/.cache/typescript/5.3/node_modules/@types/domutils/index.d.ts +124 -0
  15. package/.cache/typescript/5.3/node_modules/@types/domutils/package.json +27 -0
  16. package/.cache/typescript/5.3/node_modules/@types/htmlparser2/LICENSE +21 -0
  17. package/.cache/typescript/5.3/node_modules/@types/htmlparser2/README.md +15 -0
  18. package/.cache/typescript/5.3/node_modules/@types/htmlparser2/index.d.ts +120 -0
  19. package/.cache/typescript/5.3/node_modules/@types/htmlparser2/package.json +45 -0
  20. package/.cache/typescript/5.3/node_modules/@types/psl/LICENSE +21 -0
  21. package/.cache/typescript/5.3/node_modules/@types/psl/README.md +52 -0
  22. package/.cache/typescript/5.3/node_modules/@types/psl/index.d.ts +33 -0
  23. package/.cache/typescript/5.3/node_modules/@types/psl/package.json +25 -0
  24. package/.cache/typescript/5.3/node_modules/@types/qs/LICENSE +21 -0
  25. package/.cache/typescript/5.3/node_modules/@types/qs/README.md +15 -0
  26. package/.cache/typescript/5.3/node_modules/@types/qs/index.d.ts +79 -0
  27. package/.cache/typescript/5.3/node_modules/@types/qs/package.json +65 -0
  28. package/.cache/typescript/5.3/node_modules/domelementtype/LICENSE +11 -0
  29. package/.cache/typescript/5.3/node_modules/domelementtype/index.js +15 -0
  30. package/.cache/typescript/5.3/node_modules/domelementtype/package.json +16 -0
  31. package/.cache/typescript/5.3/node_modules/domelementtype/readme.md +1 -0
  32. package/.cache/typescript/5.3/node_modules/domhandler/.travis.yml +6 -0
  33. package/.cache/typescript/5.3/node_modules/domhandler/LICENSE +11 -0
  34. package/.cache/typescript/5.3/node_modules/domhandler/index.js +217 -0
  35. package/.cache/typescript/5.3/node_modules/domhandler/lib/element.js +20 -0
  36. package/.cache/typescript/5.3/node_modules/domhandler/lib/node.js +44 -0
  37. package/.cache/typescript/5.3/node_modules/domhandler/package.json +41 -0
  38. package/.cache/typescript/5.3/node_modules/domhandler/readme.md +116 -0
  39. package/.cache/typescript/5.3/node_modules/domhandler/test/cases/01-basic.json +57 -0
  40. package/.cache/typescript/5.3/node_modules/domhandler/test/cases/02-single_tag_1.json +21 -0
  41. package/.cache/typescript/5.3/node_modules/domhandler/test/cases/03-single_tag_2.json +21 -0
  42. package/.cache/typescript/5.3/node_modules/domhandler/test/cases/04-unescaped_in_script.json +27 -0
  43. package/.cache/typescript/5.3/node_modules/domhandler/test/cases/05-tags_in_comment.json +18 -0
  44. package/.cache/typescript/5.3/node_modules/domhandler/test/cases/06-comment_in_script.json +18 -0
  45. package/.cache/typescript/5.3/node_modules/domhandler/test/cases/07-unescaped_in_style.json +20 -0
  46. package/.cache/typescript/5.3/node_modules/domhandler/test/cases/08-extra_spaces_in_tag.json +20 -0
  47. package/.cache/typescript/5.3/node_modules/domhandler/test/cases/09-unquoted_attrib.json +20 -0
  48. package/.cache/typescript/5.3/node_modules/domhandler/test/cases/10-singular_attribute.json +15 -0
  49. package/.cache/typescript/5.3/node_modules/domhandler/test/cases/11-text_outside_tags.json +40 -0
  50. package/.cache/typescript/5.3/node_modules/domhandler/test/cases/12-text_only.json +11 -0
  51. package/.cache/typescript/5.3/node_modules/domhandler/test/cases/13-comment_in_text.json +19 -0
  52. package/.cache/typescript/5.3/node_modules/domhandler/test/cases/14-comment_in_text_in_script.json +18 -0
  53. package/.cache/typescript/5.3/node_modules/domhandler/test/cases/15-non-verbose.json +22 -0
  54. package/.cache/typescript/5.3/node_modules/domhandler/test/cases/16-normalize_whitespace.json +47 -0
  55. package/.cache/typescript/5.3/node_modules/domhandler/test/cases/17-xml_namespace.json +18 -0
  56. package/.cache/typescript/5.3/node_modules/domhandler/test/cases/18-enforce_empty_tags.json +16 -0
  57. package/.cache/typescript/5.3/node_modules/domhandler/test/cases/19-ignore_empty_tags.json +20 -0
  58. package/.cache/typescript/5.3/node_modules/domhandler/test/cases/20-template_script_tags.json +20 -0
  59. package/.cache/typescript/5.3/node_modules/domhandler/test/cases/21-conditional_comments.json +15 -0
  60. package/.cache/typescript/5.3/node_modules/domhandler/test/cases/22-lowercase_tags.json +41 -0
  61. package/.cache/typescript/5.3/node_modules/domhandler/test/cases/23-dom-lvl1.json +131 -0
  62. package/.cache/typescript/5.3/node_modules/domhandler/test/cases/24-with-start-indices.json +85 -0
  63. package/.cache/typescript/5.3/node_modules/domhandler/test/cases/25-with-end-indices.json +86 -0
  64. package/.cache/typescript/5.3/node_modules/domhandler/test/tests.js +60 -0
  65. package/.cache/typescript/5.3/package-lock.json +64 -0
  66. package/.cache/typescript/5.3/package.json +1 -1
  67. package/README.md +103 -18
  68. package/index.js +1 -1
  69. package/package.json +34 -4
  70. package/test.js +0 -35
@@ -0,0 +1,11 @@
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.
@@ -0,0 +1,15 @@
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
+ };
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "domelementtype",
3
+ "version": "1.3.1",
4
+ "description": "all the types of nodes in htmlparser2's dom",
5
+ "main": "index.js",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git://github.com/fb55/domelementtype.git"
9
+ },
10
+ "keywords": [
11
+ "dom",
12
+ "htmlparser2"
13
+ ],
14
+ "author": "Felix Boehm <me@feedic.com>",
15
+ "license": "BSD-2-Clause"
16
+ }
@@ -0,0 +1 @@
1
+ all the types of nodes in htmlparser2's dom
@@ -0,0 +1,6 @@
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
+ - 8
@@ -0,0 +1,11 @@
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.
@@ -0,0 +1,217 @@
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 && elem){
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;
@@ -0,0 +1,20 @@
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
+ });
@@ -0,0 +1,44 @@
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
+ });
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "domhandler",
3
+ "version": "2.4.2",
4
+ "description": "handler for htmlparser2 that turns pages into a dom",
5
+ "main": "index.js",
6
+ "directories": {
7
+ "test": "tests"
8
+ },
9
+ "scripts": {
10
+ "test": "mocha -R list && jshint index.js test/"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git://github.com/fb55/DomHandler.git"
15
+ },
16
+ "keywords": [
17
+ "dom",
18
+ "htmlparser2"
19
+ ],
20
+ "dependencies": {
21
+ "domelementtype": "1"
22
+ },
23
+ "devDependencies": {
24
+ "htmlparser2": "^3.9.0",
25
+ "mocha": "^3.0.2",
26
+ "jshint": "^2.9.1"
27
+ },
28
+ "author": "Felix Boehm <me@feedic.com>",
29
+ "license": "BSD-2-Clause",
30
+ "jshintConfig": {
31
+ "quotmark": "double",
32
+ "trailing": true,
33
+ "unused": true,
34
+ "undef": true,
35
+ "node": true,
36
+ "proto": true,
37
+ "globals": {
38
+ "it": true
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,116 @@
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".
@@ -0,0 +1,57 @@
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
+ }
@@ -0,0 +1,21 @@
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
+ }
@@ -0,0 +1,21 @@
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
+ }
@@ -0,0 +1,27 @@
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
+ }
@@ -0,0 +1,18 @@
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
+ }
@@ -0,0 +1,18 @@
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
+ }