netscape-bookmark-parser 1.1.4 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/LICENSE +2 -2
  2. package/README-ja.md +108 -98
  3. package/README.md +108 -98
  4. package/dist/index.d.ts +237 -0
  5. package/dist/index.js +347 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/web.d.ts +239 -0
  8. package/dist/web.js +340 -0
  9. package/dist/web.js.map +1 -0
  10. package/package.json +58 -15
  11. package/esm/_dnt.polyfills.d.ts +0 -101
  12. package/esm/_dnt.polyfills.d.ts.map +0 -1
  13. package/esm/_dnt.polyfills.js +0 -127
  14. package/esm/_dnt.shims.d.ts +0 -6
  15. package/esm/_dnt.shims.d.ts.map +0 -1
  16. package/esm/_dnt.shims.js +0 -61
  17. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/build/deno-wasm/deno-wasm.d.ts +0 -14
  18. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/build/deno-wasm/deno-wasm.d.ts.map +0 -1
  19. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/build/deno-wasm/deno-wasm.js +0 -151
  20. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/deno-dom-wasm.d.ts +0 -23
  21. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/deno-dom-wasm.d.ts.map +0 -1
  22. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/deno-dom-wasm.js +0 -26
  23. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/api.d.ts +0 -24
  24. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/api.d.ts.map +0 -1
  25. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/api.js +0 -48
  26. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/constructor-lock.d.ts +0 -5
  27. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/constructor-lock.d.ts.map +0 -1
  28. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/constructor-lock.js +0 -4
  29. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/deserialize.d.ts +0 -4
  30. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/deserialize.d.ts.map +0 -1
  31. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/deserialize.js +0 -61
  32. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/document-fragment.d.ts +0 -19
  33. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/document-fragment.d.ts.map +0 -1
  34. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/document-fragment.js +0 -110
  35. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/document.d.ts +0 -68
  36. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/document.d.ts.map +0 -1
  37. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/document.js +0 -322
  38. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/dom-parser.d.ts +0 -6
  39. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/dom-parser.d.ts.map +0 -1
  40. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/dom-parser.js +0 -46
  41. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/element.d.ts +0 -127
  42. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/element.d.ts.map +0 -1
  43. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/element.js +0 -1068
  44. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/elements/html-template-element.d.ts +0 -29
  45. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/elements/html-template-element.d.ts.map +0 -1
  46. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/elements/html-template-element.js +0 -94
  47. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/html-collection.d.ts +0 -21
  48. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/html-collection.d.ts.map +0 -1
  49. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/html-collection.js +0 -80
  50. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/node-list.d.ts +0 -23
  51. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/node-list.d.ts.map +0 -1
  52. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/node-list.js +0 -159
  53. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/node.d.ts +0 -127
  54. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/node.d.ts.map +0 -1
  55. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/node.js +0 -629
  56. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/selectors/custom-api.d.ts +0 -6
  57. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/selectors/custom-api.d.ts.map +0 -1
  58. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/selectors/custom-api.js +0 -5
  59. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/selectors/nwsapi-types.d.ts +0 -12
  60. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/selectors/nwsapi-types.d.ts.map +0 -1
  61. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/selectors/nwsapi-types.js +0 -2
  62. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/selectors/nwsapi.d.ts +0 -90
  63. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/selectors/nwsapi.d.ts.map +0 -1
  64. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/selectors/nwsapi.js +0 -1611
  65. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/selectors/selectors.d.ts +0 -16
  66. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/selectors/selectors.d.ts.map +0 -1
  67. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/selectors/selectors.js +0 -28
  68. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/selectors/sizzle-types.d.ts +0 -8
  69. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/selectors/sizzle-types.d.ts.map +0 -1
  70. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/selectors/sizzle-types.js +0 -2
  71. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/selectors/sizzle.d.ts +0 -7
  72. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/selectors/sizzle.d.ts.map +0 -1
  73. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/selectors/sizzle.js +0 -2061
  74. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/string-cache.d.ts +0 -3
  75. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/string-cache.d.ts.map +0 -1
  76. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/string-cache.js +0 -10
  77. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/utils-types.d.ts +0 -13
  78. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/utils-types.d.ts.map +0 -1
  79. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/utils-types.js +0 -8
  80. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/utils.d.ts +0 -31
  81. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/utils.d.ts.map +0 -1
  82. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/utils.js +0 -239
  83. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/parser.d.ts +0 -5
  84. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/parser.d.ts.map +0 -1
  85. package/esm/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/parser.js +0 -20
  86. package/esm/mod.d.ts +0 -10
  87. package/esm/mod.d.ts.map +0 -1
  88. package/esm/mod.js +0 -9
  89. package/esm/mod_web.d.ts +0 -9
  90. package/esm/mod_web.d.ts.map +0 -1
  91. package/esm/mod_web.js +0 -8
  92. package/esm/package.json +0 -3
  93. package/esm/src/BookmarksParser/BookmarksParser.d.ts +0 -130
  94. package/esm/src/BookmarksParser/BookmarksParser.d.ts.map +0 -1
  95. package/esm/src/BookmarksParser/BookmarksParser.js +0 -142
  96. package/esm/src/BookmarksParser/index.d.ts +0 -8
  97. package/esm/src/BookmarksParser/index.d.ts.map +0 -1
  98. package/esm/src/BookmarksParser/index.js +0 -7
  99. package/esm/src/BookmarksTree/BookmarksTree.d.ts +0 -118
  100. package/esm/src/BookmarksTree/BookmarksTree.d.ts.map +0 -1
  101. package/esm/src/BookmarksTree/BookmarksTree.js +0 -225
  102. package/esm/src/BookmarksTree/index.d.ts +0 -8
  103. package/esm/src/BookmarksTree/index.d.ts.map +0 -1
  104. package/esm/src/BookmarksTree/index.js +0 -7
  105. package/esm/src/deps.d.ts +0 -9
  106. package/esm/src/deps.d.ts.map +0 -1
  107. package/esm/src/deps.js +0 -7
  108. package/esm/src/web/BookmarksParser/BookmarksParser.d.ts +0 -130
  109. package/esm/src/web/BookmarksParser/BookmarksParser.d.ts.map +0 -1
  110. package/esm/src/web/BookmarksParser/BookmarksParser.js +0 -142
  111. package/esm/src/web/BookmarksParser/index.d.ts +0 -8
  112. package/esm/src/web/BookmarksParser/index.d.ts.map +0 -1
  113. package/esm/src/web/BookmarksParser/index.js +0 -7
  114. package/esm/src/web/BookmarksTree/BookmarksTree.d.ts +0 -118
  115. package/esm/src/web/BookmarksTree/BookmarksTree.d.ts.map +0 -1
  116. package/esm/src/web/BookmarksTree/BookmarksTree.js +0 -225
  117. package/esm/src/web/BookmarksTree/index.d.ts +0 -8
  118. package/esm/src/web/BookmarksTree/index.d.ts.map +0 -1
  119. package/esm/src/web/BookmarksTree/index.js +0 -7
  120. package/esm/src/web/deps.d.ts +0 -10
  121. package/esm/src/web/deps.d.ts.map +0 -1
  122. package/esm/src/web/deps.js +0 -9
@@ -1,629 +0,0 @@
1
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
- if (kind === "m") throw new TypeError("Private method is not writable");
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
- };
7
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
- };
12
- var _Node_nodeValue, _Node_ownerDocument, _Node_childNodes, _CharacterData_nodeValue;
13
- import { CTOR_KEY } from "../constructor-lock.js";
14
- import { NodeList, nodeListMutatorSym } from "./node-list.js";
15
- import { insertBeforeAfter, isDocumentFragment, moveDocumentFragmentChildren, } from "./utils.js";
16
- export var NodeType;
17
- (function (NodeType) {
18
- NodeType[NodeType["ELEMENT_NODE"] = 1] = "ELEMENT_NODE";
19
- NodeType[NodeType["ATTRIBUTE_NODE"] = 2] = "ATTRIBUTE_NODE";
20
- NodeType[NodeType["TEXT_NODE"] = 3] = "TEXT_NODE";
21
- NodeType[NodeType["CDATA_SECTION_NODE"] = 4] = "CDATA_SECTION_NODE";
22
- NodeType[NodeType["ENTITY_REFERENCE_NODE"] = 5] = "ENTITY_REFERENCE_NODE";
23
- NodeType[NodeType["ENTITY_NODE"] = 6] = "ENTITY_NODE";
24
- NodeType[NodeType["PROCESSING_INSTRUCTION_NODE"] = 7] = "PROCESSING_INSTRUCTION_NODE";
25
- NodeType[NodeType["COMMENT_NODE"] = 8] = "COMMENT_NODE";
26
- NodeType[NodeType["DOCUMENT_NODE"] = 9] = "DOCUMENT_NODE";
27
- NodeType[NodeType["DOCUMENT_TYPE_NODE"] = 10] = "DOCUMENT_TYPE_NODE";
28
- NodeType[NodeType["DOCUMENT_FRAGMENT_NODE"] = 11] = "DOCUMENT_FRAGMENT_NODE";
29
- NodeType[NodeType["NOTATION_NODE"] = 12] = "NOTATION_NODE";
30
- })(NodeType || (NodeType = {}));
31
- /**
32
- * Throws if any of the nodes are an ancestor
33
- * of `parentNode`
34
- */
35
- export function nodesAndTextNodes(nodes, parentNode) {
36
- return nodes.flatMap((n) => {
37
- if (isDocumentFragment(n)) {
38
- const children = Array.from(n.childNodes);
39
- moveDocumentFragmentChildren(n, parentNode);
40
- return children;
41
- }
42
- else {
43
- const node = n instanceof Node ? n : new Text(String(n));
44
- // Make sure the node isn't an ancestor of parentNode
45
- if (n === node && parentNode) {
46
- parentNode._assertNotAncestor(node);
47
- }
48
- // Remove from parentNode (if any)
49
- node._remove(true);
50
- // Set new parent
51
- node._setParent(parentNode, true);
52
- return [node];
53
- }
54
- });
55
- }
56
- export class Node extends EventTarget {
57
- get parentElement() {
58
- if (this.parentNode?.nodeType === NodeType.ELEMENT_NODE) {
59
- return this.parentNode;
60
- }
61
- return null;
62
- }
63
- constructor(nodeName, nodeType, parentNode, key) {
64
- if (key !== CTOR_KEY) {
65
- throw new TypeError("Illegal constructor.");
66
- }
67
- super();
68
- Object.defineProperty(this, "nodeName", {
69
- enumerable: true,
70
- configurable: true,
71
- writable: true,
72
- value: nodeName
73
- });
74
- Object.defineProperty(this, "nodeType", {
75
- enumerable: true,
76
- configurable: true,
77
- writable: true,
78
- value: nodeType
79
- });
80
- _Node_nodeValue.set(this, null);
81
- Object.defineProperty(this, "parentNode", {
82
- enumerable: true,
83
- configurable: true,
84
- writable: true,
85
- value: null
86
- });
87
- _Node_ownerDocument.set(this, null);
88
- _Node_childNodes.set(this, null);
89
- __classPrivateFieldSet(this, _Node_nodeValue, null, "f");
90
- if (parentNode) {
91
- parentNode.appendChild(this);
92
- }
93
- }
94
- get childNodes() {
95
- return __classPrivateFieldGet(this, _Node_childNodes, "f") || (__classPrivateFieldSet(this, _Node_childNodes, new NodeList(), "f"));
96
- }
97
- _getChildNodesMutator() {
98
- return this.childNodes[nodeListMutatorSym]();
99
- }
100
- _hasInitializedChildNodes() {
101
- return Boolean(__classPrivateFieldGet(this, _Node_childNodes, "f"));
102
- }
103
- /**
104
- * Update ancestor chain & owner document for this child
105
- * and all its children.
106
- */
107
- _setParent(newParent, force = false) {
108
- const sameParent = this.parentNode === newParent;
109
- const shouldUpdateParentAndAncestors = !sameParent || force;
110
- if (shouldUpdateParentAndAncestors) {
111
- this.parentNode = newParent;
112
- if (newParent) {
113
- if (!sameParent) {
114
- this._setOwnerDocument(__classPrivateFieldGet(newParent, _Node_ownerDocument, "f"));
115
- }
116
- }
117
- // Update ancestors for child nodes
118
- if (this._hasInitializedChildNodes()) {
119
- for (const child of this.childNodes) {
120
- child._setParent(this, shouldUpdateParentAndAncestors);
121
- }
122
- }
123
- }
124
- }
125
- _assertNotAncestor(child) {
126
- // Check this child isn't an ancestor
127
- if (child.contains(this)) {
128
- throw new DOMException("The new child is an ancestor of the parent");
129
- }
130
- }
131
- _setOwnerDocument(document) {
132
- if (__classPrivateFieldGet(this, _Node_ownerDocument, "f") !== document) {
133
- __classPrivateFieldSet(this, _Node_ownerDocument, document, "f");
134
- if (this._hasInitializedChildNodes()) {
135
- for (const child of this.childNodes) {
136
- child._setOwnerDocument(document);
137
- }
138
- }
139
- }
140
- }
141
- contains(child) {
142
- let node = child;
143
- while (node) {
144
- if (node === this) {
145
- return true;
146
- }
147
- node = node.parentNode;
148
- }
149
- return false;
150
- }
151
- get ownerDocument() {
152
- return __classPrivateFieldGet(this, _Node_ownerDocument, "f");
153
- }
154
- get nodeValue() {
155
- return __classPrivateFieldGet(this, _Node_nodeValue, "f");
156
- }
157
- set nodeValue(value) {
158
- // Setting is ignored
159
- }
160
- get textContent() {
161
- let out = "";
162
- for (const child of this.childNodes) {
163
- switch (child.nodeType) {
164
- case NodeType.TEXT_NODE:
165
- out += child.nodeValue;
166
- break;
167
- case NodeType.ELEMENT_NODE:
168
- out += child.textContent;
169
- break;
170
- }
171
- }
172
- return out;
173
- }
174
- set textContent(content) {
175
- for (const child of this.childNodes) {
176
- child._setParent(null);
177
- }
178
- this._getChildNodesMutator().splice(0, this.childNodes.length);
179
- this.appendChild(new Text(content));
180
- }
181
- get firstChild() {
182
- if (!this._hasInitializedChildNodes()) {
183
- return null;
184
- }
185
- return this.childNodes[0] || null;
186
- }
187
- get lastChild() {
188
- if (!this._hasInitializedChildNodes()) {
189
- return null;
190
- }
191
- return this.childNodes[this.childNodes.length - 1] || null;
192
- }
193
- hasChildNodes() {
194
- return this._hasInitializedChildNodes() && Boolean(this.childNodes.length);
195
- }
196
- cloneNode(deep = false) {
197
- const copy = this._shallowClone();
198
- copy._setOwnerDocument(this.ownerDocument);
199
- if (deep && this._hasInitializedChildNodes()) {
200
- for (const child of this.childNodes) {
201
- copy.appendChild(child.cloneNode(true));
202
- }
203
- }
204
- return copy;
205
- }
206
- _shallowClone() {
207
- throw new Error("Illegal invocation");
208
- }
209
- _remove(skipSetParent = false) {
210
- const parent = this.parentNode;
211
- if (parent) {
212
- const nodeList = parent._getChildNodesMutator();
213
- const idx = nodeList.indexOf(this);
214
- nodeList.splice(idx, 1);
215
- if (!skipSetParent) {
216
- this._setParent(null);
217
- }
218
- }
219
- }
220
- appendChild(child) {
221
- if (isDocumentFragment(child)) {
222
- const mutator = this._getChildNodesMutator();
223
- mutator.push(...child.childNodes);
224
- moveDocumentFragmentChildren(child, this);
225
- return child;
226
- }
227
- else {
228
- return child._appendTo(this);
229
- }
230
- }
231
- _appendTo(parentNode) {
232
- parentNode._assertNotAncestor(this); // FIXME: Should this really be a method?
233
- const oldParentNode = this.parentNode;
234
- // Check if we already own this child
235
- if (oldParentNode === parentNode) {
236
- if (parentNode._getChildNodesMutator().indexOf(this) !== -1) {
237
- return this;
238
- }
239
- }
240
- else if (oldParentNode) {
241
- this._remove();
242
- }
243
- this._setParent(parentNode, true);
244
- parentNode._getChildNodesMutator().push(this);
245
- return this;
246
- }
247
- removeChild(child) {
248
- // Just copy Firefox's error messages
249
- if (child && typeof child === "object") {
250
- if (child.parentNode === this) {
251
- child._remove();
252
- return child;
253
- }
254
- else {
255
- throw new DOMException("Node.removeChild: The node to be removed is not a child of this node");
256
- }
257
- }
258
- else {
259
- throw new TypeError("Node.removeChild: Argument 1 is not an object.");
260
- }
261
- }
262
- replaceChild(newChild, oldChild) {
263
- if (oldChild.parentNode !== this) {
264
- throw new Error("Old child's parent is not the current node.");
265
- }
266
- oldChild._replaceWith(newChild);
267
- return oldChild;
268
- }
269
- insertBefore(newNode, refNode) {
270
- this._assertNotAncestor(newNode);
271
- const mutator = this._getChildNodesMutator();
272
- if (refNode === null) {
273
- this.appendChild(newNode);
274
- return newNode;
275
- }
276
- const index = mutator.indexOf(refNode);
277
- if (index === -1) {
278
- throw new Error("DOMException: Child to insert before is not a child of this node");
279
- }
280
- if (isDocumentFragment(newNode)) {
281
- mutator.splice(index, 0, ...newNode.childNodes);
282
- moveDocumentFragmentChildren(newNode, this);
283
- }
284
- else {
285
- const oldParentNode = newNode.parentNode;
286
- const oldMutator = oldParentNode?._getChildNodesMutator();
287
- if (oldMutator) {
288
- oldMutator.splice(oldMutator.indexOf(newNode), 1);
289
- }
290
- newNode._setParent(this, oldParentNode !== this);
291
- mutator.splice(index, 0, newNode);
292
- }
293
- return newNode;
294
- }
295
- _replaceWith(...nodes) {
296
- if (this.parentNode) {
297
- const parentNode = this.parentNode;
298
- const mutator = parentNode._getChildNodesMutator();
299
- let viableNextSibling = null;
300
- {
301
- const thisIndex = mutator.indexOf(this);
302
- for (let i = thisIndex + 1; i < parentNode.childNodes.length; i++) {
303
- if (!nodes.includes(parentNode.childNodes[i])) {
304
- viableNextSibling = parentNode.childNodes[i];
305
- break;
306
- }
307
- }
308
- }
309
- nodes = nodesAndTextNodes(nodes, parentNode);
310
- let index = viableNextSibling
311
- ? mutator.indexOf(viableNextSibling)
312
- : parentNode.childNodes.length;
313
- let deleteNumber;
314
- if (parentNode.childNodes[index - 1] === this) {
315
- index--;
316
- deleteNumber = 1;
317
- }
318
- else {
319
- deleteNumber = 0;
320
- }
321
- mutator.splice(index, deleteNumber, ...nodes);
322
- this._setParent(null);
323
- }
324
- }
325
- get nextSibling() {
326
- const parent = this.parentNode;
327
- if (!parent) {
328
- return null;
329
- }
330
- const index = parent._getChildNodesMutator().indexOf(this);
331
- const next = parent.childNodes[index + 1] || null;
332
- return next;
333
- }
334
- get previousSibling() {
335
- const parent = this.parentNode;
336
- if (!parent) {
337
- return null;
338
- }
339
- const index = parent._getChildNodesMutator().indexOf(this);
340
- const prev = parent.childNodes[index - 1] || null;
341
- return prev;
342
- }
343
- /**
344
- * FIXME: Does not implement attribute node checks
345
- * ref: https://dom.spec.whatwg.org/#dom-node-comparedocumentposition
346
- * MDN: https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
347
- */
348
- compareDocumentPosition(other) {
349
- if (other === this) {
350
- return 0;
351
- }
352
- // Note: major browser implementations differ in their rejection error of
353
- // non-Node or nullish values so we just copy the most relevant error message
354
- // from Firefox
355
- if (!(other instanceof Node)) {
356
- throw new TypeError("Node.compareDocumentPosition: Argument 1 does not implement interface Node.");
357
- }
358
- let node1Root = other;
359
- let node2Root = this;
360
- const node1Hierarchy = [node1Root];
361
- const node2Hierarchy = [node2Root];
362
- while (node1Root.parentNode ?? node2Root.parentNode) {
363
- node1Root = node1Root.parentNode
364
- ? (node1Hierarchy.push(node1Root.parentNode), node1Root.parentNode)
365
- : node1Root;
366
- node2Root = node2Root.parentNode
367
- ? (node2Hierarchy.push(node2Root.parentNode), node2Root.parentNode)
368
- : node2Root;
369
- }
370
- // Check if they don't share the same root node
371
- if (node1Root !== node2Root) {
372
- return Node.DOCUMENT_POSITION_DISCONNECTED |
373
- Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC |
374
- Node.DOCUMENT_POSITION_PRECEDING;
375
- }
376
- const longerHierarchy = node1Hierarchy.length > node2Hierarchy.length
377
- ? node1Hierarchy
378
- : node2Hierarchy;
379
- const shorterHierarchy = longerHierarchy === node1Hierarchy
380
- ? node2Hierarchy
381
- : node1Hierarchy;
382
- // Check if either is a container of the other
383
- if (longerHierarchy[longerHierarchy.length - shorterHierarchy.length] ===
384
- shorterHierarchy[0]) {
385
- return longerHierarchy === node1Hierarchy
386
- // other is a child of this
387
- ? Node.DOCUMENT_POSITION_CONTAINED_BY | Node.DOCUMENT_POSITION_FOLLOWING
388
- // this is a child of other
389
- : Node.DOCUMENT_POSITION_CONTAINS | Node.DOCUMENT_POSITION_PRECEDING;
390
- }
391
- // Find their first common ancestor and see whether they
392
- // are preceding or following
393
- const longerStart = longerHierarchy.length - shorterHierarchy.length;
394
- for (let i = shorterHierarchy.length - 1; i >= 0; i--) {
395
- const shorterHierarchyNode = shorterHierarchy[i];
396
- const longerHierarchyNode = longerHierarchy[longerStart + i];
397
- // We found the first common ancestor
398
- if (longerHierarchyNode !== shorterHierarchyNode) {
399
- const siblings = shorterHierarchyNode.parentNode
400
- ._getChildNodesMutator();
401
- if (siblings.indexOf(shorterHierarchyNode) <
402
- siblings.indexOf(longerHierarchyNode)) {
403
- // Shorter is before longer
404
- if (shorterHierarchy === node1Hierarchy) {
405
- // Other is before this
406
- return Node.DOCUMENT_POSITION_PRECEDING;
407
- }
408
- else {
409
- // This is before other
410
- return Node.DOCUMENT_POSITION_FOLLOWING;
411
- }
412
- }
413
- else {
414
- // Longer is before shorter
415
- if (longerHierarchy === node1Hierarchy) {
416
- // Other is before this
417
- return Node.DOCUMENT_POSITION_PRECEDING;
418
- }
419
- else {
420
- // Other is after this
421
- return Node.DOCUMENT_POSITION_FOLLOWING;
422
- }
423
- }
424
- }
425
- }
426
- // FIXME: Should probably throw here because this
427
- // point should be unreachable code as per the
428
- // intended logic
429
- return Node.DOCUMENT_POSITION_FOLLOWING;
430
- }
431
- getRootNode(opts = {}) {
432
- if (this.parentNode) {
433
- return this.parentNode.getRootNode(opts);
434
- }
435
- if (opts.composed && this.host) {
436
- return this.host.getRootNode(opts);
437
- }
438
- return this;
439
- }
440
- }
441
- _Node_nodeValue = new WeakMap(), _Node_ownerDocument = new WeakMap(), _Node_childNodes = new WeakMap();
442
- // Instance constants defined after Node
443
- // class body below to avoid clutter
444
- Object.defineProperty(Node, "ELEMENT_NODE", {
445
- enumerable: true,
446
- configurable: true,
447
- writable: true,
448
- value: NodeType.ELEMENT_NODE
449
- });
450
- Object.defineProperty(Node, "ATTRIBUTE_NODE", {
451
- enumerable: true,
452
- configurable: true,
453
- writable: true,
454
- value: NodeType.ATTRIBUTE_NODE
455
- });
456
- Object.defineProperty(Node, "TEXT_NODE", {
457
- enumerable: true,
458
- configurable: true,
459
- writable: true,
460
- value: NodeType.TEXT_NODE
461
- });
462
- Object.defineProperty(Node, "CDATA_SECTION_NODE", {
463
- enumerable: true,
464
- configurable: true,
465
- writable: true,
466
- value: NodeType.CDATA_SECTION_NODE
467
- });
468
- Object.defineProperty(Node, "ENTITY_REFERENCE_NODE", {
469
- enumerable: true,
470
- configurable: true,
471
- writable: true,
472
- value: NodeType.ENTITY_REFERENCE_NODE
473
- });
474
- Object.defineProperty(Node, "ENTITY_NODE", {
475
- enumerable: true,
476
- configurable: true,
477
- writable: true,
478
- value: NodeType.ENTITY_NODE
479
- });
480
- Object.defineProperty(Node, "PROCESSING_INSTRUCTION_NODE", {
481
- enumerable: true,
482
- configurable: true,
483
- writable: true,
484
- value: NodeType.PROCESSING_INSTRUCTION_NODE
485
- });
486
- Object.defineProperty(Node, "COMMENT_NODE", {
487
- enumerable: true,
488
- configurable: true,
489
- writable: true,
490
- value: NodeType.COMMENT_NODE
491
- });
492
- Object.defineProperty(Node, "DOCUMENT_NODE", {
493
- enumerable: true,
494
- configurable: true,
495
- writable: true,
496
- value: NodeType.DOCUMENT_NODE
497
- });
498
- Object.defineProperty(Node, "DOCUMENT_TYPE_NODE", {
499
- enumerable: true,
500
- configurable: true,
501
- writable: true,
502
- value: NodeType.DOCUMENT_TYPE_NODE
503
- });
504
- Object.defineProperty(Node, "DOCUMENT_FRAGMENT_NODE", {
505
- enumerable: true,
506
- configurable: true,
507
- writable: true,
508
- value: NodeType.DOCUMENT_FRAGMENT_NODE
509
- });
510
- Object.defineProperty(Node, "NOTATION_NODE", {
511
- enumerable: true,
512
- configurable: true,
513
- writable: true,
514
- value: NodeType.NOTATION_NODE
515
- });
516
- // Node.compareDocumentPosition()'s bitmask values
517
- Object.defineProperty(Node, "DOCUMENT_POSITION_DISCONNECTED", {
518
- enumerable: true,
519
- configurable: true,
520
- writable: true,
521
- value: 1
522
- });
523
- Object.defineProperty(Node, "DOCUMENT_POSITION_PRECEDING", {
524
- enumerable: true,
525
- configurable: true,
526
- writable: true,
527
- value: 2
528
- });
529
- Object.defineProperty(Node, "DOCUMENT_POSITION_FOLLOWING", {
530
- enumerable: true,
531
- configurable: true,
532
- writable: true,
533
- value: 4
534
- });
535
- Object.defineProperty(Node, "DOCUMENT_POSITION_CONTAINS", {
536
- enumerable: true,
537
- configurable: true,
538
- writable: true,
539
- value: 8
540
- });
541
- Object.defineProperty(Node, "DOCUMENT_POSITION_CONTAINED_BY", {
542
- enumerable: true,
543
- configurable: true,
544
- writable: true,
545
- value: 16
546
- });
547
- Object.defineProperty(Node, "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC", {
548
- enumerable: true,
549
- configurable: true,
550
- writable: true,
551
- value: 32
552
- });
553
- Node.prototype.ELEMENT_NODE = NodeType.ELEMENT_NODE;
554
- Node.prototype.ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE;
555
- Node.prototype.TEXT_NODE = NodeType.TEXT_NODE;
556
- Node.prototype.CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE;
557
- Node.prototype.ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE;
558
- Node.prototype.ENTITY_NODE = NodeType.ENTITY_NODE;
559
- Node.prototype.PROCESSING_INSTRUCTION_NODE =
560
- NodeType.PROCESSING_INSTRUCTION_NODE;
561
- Node.prototype.COMMENT_NODE = NodeType.COMMENT_NODE;
562
- Node.prototype.DOCUMENT_NODE = NodeType.DOCUMENT_NODE;
563
- Node.prototype.DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE;
564
- Node.prototype.DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE;
565
- Node.prototype.NOTATION_NODE = NodeType.NOTATION_NODE;
566
- export class CharacterData extends Node {
567
- constructor(data, nodeName, nodeType, parentNode, key) {
568
- super(nodeName, nodeType, parentNode, key);
569
- _CharacterData_nodeValue.set(this, "");
570
- __classPrivateFieldSet(this, _CharacterData_nodeValue, data, "f");
571
- }
572
- get nodeValue() {
573
- return __classPrivateFieldGet(this, _CharacterData_nodeValue, "f");
574
- }
575
- set nodeValue(value) {
576
- __classPrivateFieldSet(this, _CharacterData_nodeValue, String(value ?? ""), "f");
577
- }
578
- get data() {
579
- return __classPrivateFieldGet(this, _CharacterData_nodeValue, "f");
580
- }
581
- set data(value) {
582
- this.nodeValue = value;
583
- }
584
- get textContent() {
585
- return __classPrivateFieldGet(this, _CharacterData_nodeValue, "f");
586
- }
587
- set textContent(value) {
588
- this.nodeValue = value;
589
- }
590
- get length() {
591
- return this.data.length;
592
- }
593
- before(...nodes) {
594
- if (this.parentNode) {
595
- insertBeforeAfter(this, nodes, true);
596
- }
597
- }
598
- after(...nodes) {
599
- if (this.parentNode) {
600
- insertBeforeAfter(this, nodes, false);
601
- }
602
- }
603
- remove() {
604
- this._remove();
605
- }
606
- replaceWith(...nodes) {
607
- this._replaceWith(...nodes);
608
- }
609
- }
610
- _CharacterData_nodeValue = new WeakMap();
611
- export class Text extends CharacterData {
612
- constructor(text = "") {
613
- super(String(text), "#text", NodeType.TEXT_NODE, null, CTOR_KEY);
614
- }
615
- _shallowClone() {
616
- return new Text(this.textContent);
617
- }
618
- }
619
- export class Comment extends CharacterData {
620
- constructor(text = "") {
621
- super(String(text), "#comment", NodeType.COMMENT_NODE, null, CTOR_KEY);
622
- }
623
- _shallowClone() {
624
- return new Comment(this.textContent);
625
- }
626
- get textContent() {
627
- return this.nodeValue;
628
- }
629
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * Symbols for using getElementsByTagName/ClassName on document-fragment
3
- */
4
- export declare const customByTagNameSym: unique symbol;
5
- export declare const customByClassNameSym: unique symbol;
6
- //# sourceMappingURL=custom-api.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"custom-api.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/selectors/custom-api.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,kBAAkB,eAAW,CAAC;AAC3C,eAAO,MAAM,oBAAoB,eAAW,CAAC"}
@@ -1,5 +0,0 @@
1
- /**
2
- * Symbols for using getElementsByTagName/ClassName on document-fragment
3
- */
4
- export const customByTagNameSym = Symbol();
5
- export const customByClassNameSym = Symbol();
@@ -1,12 +0,0 @@
1
- import type { Element } from "../element.js";
2
- import type { Document } from "../document.js";
3
- export declare const DOM: (doc: Document) => {
4
- ancestor(selector: string, context: Element | Document, callback?: (element: Element) => void): Element | null;
5
- first(selector: string, context: Element | Document, callback?: (element: Element) => void): Element | null;
6
- match(selector: string, context: Element | Document, callback?: (element: Element) => void): boolean;
7
- select(selector: string, context: Element | Document, callback?: (element: Element) => void): Element[];
8
- byId(id: string, from: Element | Document): Element[];
9
- byTag(tag: string, from: Element | Document): Element[];
10
- byClass(tag: string, from: Element | Document): Element[];
11
- };
12
- //# sourceMappingURL=nwsapi-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nwsapi-types.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/deps/jsr.io/@b-fuze/deno-dom/0.1.49/src/dom/selectors/nwsapi-types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,eAAO,MAAM,GAAG,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK;IACnC,QAAQ,CACN,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,OAAO,GAAG,QAAQ,EAC3B,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GACpC,OAAO,GAAG,IAAI,CAAC;IAClB,KAAK,CACH,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,OAAO,GAAG,QAAQ,EAC3B,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GACpC,OAAO,GAAG,IAAI,CAAC;IAClB,KAAK,CACH,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,OAAO,GAAG,QAAQ,EAC3B,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GACpC,OAAO,CAAC;IACX,MAAM,CACJ,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,OAAO,GAAG,QAAQ,EAC3B,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GACpC,OAAO,EAAE,CAAC;IACb,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,EAAE,CAAC;IACtD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,EAAE,CAAC;IACxD,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,EAAE,CAAC;CAC5C,CAAC"}
@@ -1,2 +0,0 @@
1
- import NWDom from "./nwsapi.js";
2
- export const DOM = NWDom;