@twobirds/microcomponents 0.0.72 → 0.0.75
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.
- package/README.md +35 -24
- package/assets/documentation/MC.md +2 -2
- package/assets/documentation/MicroComponents.svg +15 -0
- package/assets/documentation/elements.md +18 -16
- package/assets/documentation/formvalues.md +5 -26
- package/assets/documentation/observables.md +18 -24
- package/assets/test/test.html +5 -4
- package/assets/test/testform.json +27 -0
- package/dist/MC.d.ts +2 -2
- package/dist/MC.d.ts.map +1 -1
- package/dist/MC.min.js +2 -1
- package/dist/MC.ts +6 -3
- package/dist/elements.min.js +1 -1
- package/dist/formValues.d.ts.map +1 -1
- package/dist/formValues.ts +0 -14
- package/dist/formvValues.min.js +1 -1
- package/dist/microcomponents.min.js +1 -1
- package/dist/observables.d.ts.map +1 -1
- package/dist/observables.min.js +1 -1
- package/dist/observables.ts +177 -169
- package/dist/selectors.min.js +1 -1
- package/package.json +1 -1
- package/public/MC.d.ts +2 -2
- package/public/MC.d.ts.map +1 -1
- package/public/MC.js +4 -3
- package/public/MC.js.map +1 -1
- package/public/MC.min.js +2 -1
- package/public/MC.ts +6 -3
- package/public/documentation/MC.md +2 -2
- package/public/documentation/MicroComponents.svg +15 -0
- package/public/documentation/elements.md +18 -16
- package/public/documentation/formvalues.md +5 -26
- package/public/documentation/klemmstein.png +0 -0
- package/public/documentation/observables.md +18 -24
- package/public/elements.min.js +1 -1
- package/public/formValues.d.ts.map +1 -1
- package/public/formValues.js.map +1 -1
- package/public/formValues.ts +0 -14
- package/public/formvValues.min.js +1 -1
- package/public/microcomponents.min.js +1 -1
- package/public/observables.d.ts.map +1 -1
- package/public/observables.js +111 -118
- package/public/observables.js.map +1 -1
- package/public/observables.min.js +1 -1
- package/public/observables.ts +177 -169
- package/public/selectors.min.js +1 -1
- package/public/src/MC.ts +6 -3
- package/public/src/formValues.ts +0 -14
- package/public/src/observables.ts +177 -169
- package/public/test/MC.d.ts +2 -2
- package/public/test/MC.d.ts.map +1 -1
- package/public/test/MC.js +4 -3
- package/public/test/MC.js.map +1 -1
- package/public/test/MC.ts +6 -3
- package/public/test/formValues.d.ts.map +1 -1
- package/public/test/formValues.js.map +1 -1
- package/public/test/formValues.ts +0 -14
- package/public/test/microcomponents.min.js +1 -1
- package/public/test/observables.d.ts.map +1 -1
- package/public/test/observables.js +111 -118
- package/public/test/observables.js.map +1 -1
- package/public/test/observables.ts +177 -169
- package/public/test/test/grandparent.js +1 -1
- package/public/test/test/testform.js +1 -1
- package/public/test/test/testform.js.map +1 -1
- package/public/test/test.d.ts.map +1 -1
- package/public/test/test.html +5 -4
- package/public/test/test.js +5 -6
- package/public/test/test.js.map +1 -1
- package/public/test/testform.json +27 -0
- package/public/typedoc/assets/navigation.js +1 -1
- package/public/typedoc/assets/search.js +1 -1
- package/public/typedoc/classes/MC.DC.html +2 -2
- package/public/typedoc/classes/MC.MC.html +2 -2
- package/public/typedoc/classes/MC.McBase.html +2 -2
- package/public/typedoc/classes/MC.McEvent.html +2 -2
- package/public/typedoc/functions/MC.addListener.html +1 -1
- package/public/typedoc/functions/MC.autoload.html +1 -1
- package/public/typedoc/functions/MC.removeListener.html +1 -1
- package/public/typedoc/functions/elements.defineCE.html +1 -1
- package/public/typedoc/functions/elements.getCE.html +1 -1
- package/public/typedoc/functions/formValues.formValues.html +1 -1
- package/public/typedoc/functions/observables.observe.html +1 -1
- package/public/typedoc/index.html +40 -23
- package/public/typedoc/interfaces/MC.HTMLMcElement.html +2 -2
- package/public/typedoc/modules/MC.html +1 -1
- package/public/typedoc/modules/elements.html +1 -1
- package/public/typedoc/modules/formValues.html +1 -1
- package/public/typedoc/modules/observables.html +1 -1
- package/public/typedoc/modules.html +0 -1
- package/public/typedoc/types/observables.Observable.html +1 -1
- package/src/MC.ts +6 -3
- package/src/formValues.ts +0 -14
- package/src/observables.ts +177 -169
- package/src/test/test/testform.ts +10 -2
- package/src/{test.ts → test/test.ts} +32 -26
- package/tsconfig.json +2 -2
- package/typedoc.json +1 -1
- package/checklist.md +0 -93
- package/dist/microcomponents.es3.d.ts +0 -2
- package/dist/microcomponents.es3.d.ts.map +0 -1
- package/dist/test.d.ts +0 -2
- package/dist/test.d.ts.map +0 -1
- package/dist/test.ts +0 -194
- package/public/microcomponents.es3.d.ts +0 -2
- package/public/microcomponents.es3.d.ts.map +0 -1
- package/public/microcomponents.es3.js +0 -303
- package/public/microcomponents.es3.js.map +0 -1
- package/public/src/test.ts +0 -194
- package/public/test/microcomponents.es3.d.ts +0 -2
- package/public/test/microcomponents.es3.d.ts.map +0 -1
- package/public/test/microcomponents.es3.js +0 -303
- package/public/test/microcomponents.es3.js.map +0 -1
- package/public/test/test.ts +0 -194
- package/public/typedoc/functions/selectors._d.html +0 -1
- package/public/typedoc/functions/selectors._t.html +0 -1
- package/public/typedoc/interfaces/selectors.DSelector.html +0 -50
- package/public/typedoc/interfaces/selectors.TSelector.html +0 -34
- package/public/typedoc/modules/selectors.html +0 -7
- package/public/typedoc/types/selectors.selection.html +0 -1
- package/public/typedoc/types/selectors.singleSelector.html +0 -1
- package/src/microcomponents.es3.js +0 -377
- /package/{klemmstein.png → assets/documentation/klemmstein.png} +0 -0
|
@@ -1,377 +0,0 @@
|
|
|
1
|
-
(function () {
|
|
2
|
-
// Polyfill for String.prototype.trim (ES3-compliant)
|
|
3
|
-
if (!String.prototype.trim) {
|
|
4
|
-
String.prototype.trim = function () {
|
|
5
|
-
return this.replace(/^\s+|\s+$/g, "");
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// Helper function to remove duplicates from an array
|
|
10
|
-
function unique(elements) {
|
|
11
|
-
var uniqueElements = [];
|
|
12
|
-
for (var i = 0; i < elements.length; i++) {
|
|
13
|
-
if (uniqueElements.indexOf(elements[i]) === -1) {
|
|
14
|
-
uniqueElements.push(elements[i]);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return uniqueElements;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// Helper function to check if an element matches an attribute selector
|
|
21
|
-
function matchesAttribute(element, attrSelector) {
|
|
22
|
-
var match = attrSelector.match(
|
|
23
|
-
/^\[([^\]=~^$*]+)([~^$*|]?=)?(['"]?)(.*?)\3\]$/
|
|
24
|
-
);
|
|
25
|
-
if (!match) return false;
|
|
26
|
-
|
|
27
|
-
var attrName = match[1];
|
|
28
|
-
var operator = match[2] || null;
|
|
29
|
-
var attrValue = match[4] || null;
|
|
30
|
-
var actualValue = element.getAttribute(attrName);
|
|
31
|
-
|
|
32
|
-
if (actualValue === null) return false; // Attribute does not exist
|
|
33
|
-
|
|
34
|
-
switch (operator) {
|
|
35
|
-
case null: // [attr]
|
|
36
|
-
return true;
|
|
37
|
-
case "=": // [attr=value]
|
|
38
|
-
return actualValue === attrValue;
|
|
39
|
-
case "~=": // [attr~=value]
|
|
40
|
-
return (" " + actualValue + " ").indexOf(" " + attrValue + " ") !== -1;
|
|
41
|
-
case "^=": // [attr^=value]
|
|
42
|
-
return actualValue.indexOf(attrValue) === 0;
|
|
43
|
-
case "$=": // [attr$=value]
|
|
44
|
-
return actualValue.slice(-attrValue.length) === attrValue;
|
|
45
|
-
case "*=": // [attr*=value]
|
|
46
|
-
return actualValue.indexOf(attrValue) !== -1;
|
|
47
|
-
default:
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Helper function to check if an element matches a selector
|
|
53
|
-
function matchesSelector(element, selector) {
|
|
54
|
-
var regex = /(\w+)?(?:\.([\w\-]+))?(?:\[.*?\])?/g;
|
|
55
|
-
var match, tagMatch, classMatch, attrMatch;
|
|
56
|
-
|
|
57
|
-
while ((match = regex.exec(selector))) {
|
|
58
|
-
tagMatch = match[1];
|
|
59
|
-
classMatch = match[2] ? match[2].split(".") : null;
|
|
60
|
-
attrMatch = selector.match(/\[.*?\]/g);
|
|
61
|
-
|
|
62
|
-
if (
|
|
63
|
-
tagMatch &&
|
|
64
|
-
element.tagName.toLowerCase() !== tagMatch.toLowerCase()
|
|
65
|
-
) {
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (classMatch) {
|
|
70
|
-
for (var i = 0; i < classMatch.length; i++) {
|
|
71
|
-
if (
|
|
72
|
-
(" " + element.className + " ").indexOf(
|
|
73
|
-
" " + classMatch[i] + " "
|
|
74
|
-
) === -1
|
|
75
|
-
) {
|
|
76
|
-
return false;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (attrMatch) {
|
|
82
|
-
for (var j = 0; j < attrMatch.length; j++) {
|
|
83
|
-
if (!matchesAttribute(element, attrMatch[j])) {
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return true;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Polyfill for document.querySelectorAll
|
|
93
|
-
if (!document.querySelectorAll) {
|
|
94
|
-
document.querySelectorAll = function (selectors) {
|
|
95
|
-
var simpleSelectors = selectors.split(",");
|
|
96
|
-
var results = [];
|
|
97
|
-
for (var i = 0; i < simpleSelectors.length; i++) {
|
|
98
|
-
var selector = simpleSelectors[i].trim();
|
|
99
|
-
if (!selector) continue;
|
|
100
|
-
|
|
101
|
-
var allElements = document.getElementsByTagName("*");
|
|
102
|
-
for (var j = 0; j < allElements.length; j++) {
|
|
103
|
-
if (matchesSelector(allElements[j], selector)) {
|
|
104
|
-
results.push(allElements[j]);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return unique(results); // Return unique results
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Polyfill for document.querySelector
|
|
113
|
-
if (!document.querySelector) {
|
|
114
|
-
document.querySelector = function (selectors) {
|
|
115
|
-
var elements = document.querySelectorAll(selectors);
|
|
116
|
-
return elements.length ? elements[0] : null;
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// Polyfill for HTMLElement.prototype.querySelectorAll
|
|
121
|
-
if (
|
|
122
|
-
typeof HTMLElement !== "undefined" &&
|
|
123
|
-
!HTMLElement.prototype.querySelectorAll
|
|
124
|
-
) {
|
|
125
|
-
HTMLElement.prototype.querySelectorAll = function (selectors) {
|
|
126
|
-
var simpleSelectors = selectors.split(",");
|
|
127
|
-
var results = [];
|
|
128
|
-
for (var i = 0; i < simpleSelectors.length; i++) {
|
|
129
|
-
var selector = simpleSelectors[i].trim();
|
|
130
|
-
if (!selector) continue;
|
|
131
|
-
|
|
132
|
-
var allElements = this.getElementsByTagName("*");
|
|
133
|
-
for (var j = 0; j < allElements.length; j++) {
|
|
134
|
-
if (matchesSelector(allElements[j], selector)) {
|
|
135
|
-
results.push(allElements[j]);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return unique(results); // Return unique results
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// Polyfill for HTMLElement.prototype.querySelector
|
|
144
|
-
if (
|
|
145
|
-
typeof HTMLElement !== "undefined" &&
|
|
146
|
-
!HTMLElement.prototype.querySelector
|
|
147
|
-
) {
|
|
148
|
-
HTMLElement.prototype.querySelector = function (selectors) {
|
|
149
|
-
var elements = this.querySelectorAll(selectors);
|
|
150
|
-
return elements.length ? elements[0] : null;
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// Polyfill for Object.values()
|
|
155
|
-
if (!Object.values) {
|
|
156
|
-
Object.values = function (obj) {
|
|
157
|
-
if (
|
|
158
|
-
obj === null ||
|
|
159
|
-
(typeof obj !== "object" && typeof obj !== "function")
|
|
160
|
-
) {
|
|
161
|
-
throw new TypeError("Object.values called on a non-object");
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
var values = [];
|
|
165
|
-
for (var key in obj) {
|
|
166
|
-
if (obj.hasOwnProperty(key)) {
|
|
167
|
-
values.push(obj[key]);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
return values;
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
})();
|
|
174
|
-
|
|
175
|
-
window.MC = (function () {
|
|
176
|
-
/*
|
|
177
|
-
helper methods
|
|
178
|
-
*/
|
|
179
|
-
// get all microcomponents from a list of HTMLElements
|
|
180
|
-
function getMicroComponents(elements, search) {
|
|
181
|
-
let mcValues = [];
|
|
182
|
-
elements.forEach((e) => {
|
|
183
|
-
if (e) {
|
|
184
|
-
if (e instanceof HTMLElement) {
|
|
185
|
-
const _mc = e?._mc;
|
|
186
|
-
if (!search && _mc) {
|
|
187
|
-
mcValues = mcValues.concat(Object.values(e._mc));
|
|
188
|
-
} else if (search && _mc && _mc[search]) {
|
|
189
|
-
mcValues.push(_mc[search]);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
return mcValues;
|
|
195
|
-
}
|
|
196
|
-
// get all ancestor DOM nodes up to the document
|
|
197
|
-
function traverseNodes(node, search, firstonly = true) {
|
|
198
|
-
let mcValues = [];
|
|
199
|
-
while (node) {
|
|
200
|
-
if (node._mc) {
|
|
201
|
-
if (!search) {
|
|
202
|
-
mcValues = mcValues.concat(Object.values(node._mc));
|
|
203
|
-
} else if (search && node._mc[search]) {
|
|
204
|
-
mcValues.push(node._mc[search]);
|
|
205
|
-
}
|
|
206
|
-
if (firstonly) return mcValues;
|
|
207
|
-
}
|
|
208
|
-
node = node.parentNode;
|
|
209
|
-
}
|
|
210
|
-
return mcValues;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
function isDOM(element) {
|
|
214
|
-
return element && element instanceof HTMLElement;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// continue here....
|
|
218
|
-
var MC = function () {};
|
|
219
|
-
|
|
220
|
-
class MC {
|
|
221
|
-
#target = {};
|
|
222
|
-
#_mc = {};
|
|
223
|
-
static debug = false;
|
|
224
|
-
constructor(target) {
|
|
225
|
-
this.#target = target;
|
|
226
|
-
this.#_mc = {};
|
|
227
|
-
}
|
|
228
|
-
get _mc() {
|
|
229
|
-
if (!MC.debug) return undefined;
|
|
230
|
-
return this.#_mc;
|
|
231
|
-
}
|
|
232
|
-
get target() {
|
|
233
|
-
return this.#target;
|
|
234
|
-
}
|
|
235
|
-
// return all top-level micro components from an HTMLElement, or the searched one
|
|
236
|
-
static siblings(target, search = "") {
|
|
237
|
-
const mc = target;
|
|
238
|
-
if (!mc._mc) {
|
|
239
|
-
return [];
|
|
240
|
-
}
|
|
241
|
-
const _mc = mc._mc;
|
|
242
|
-
if (search.length) {
|
|
243
|
-
return _mc?.[search] || [];
|
|
244
|
-
}
|
|
245
|
-
return [...Object.values(_mc)];
|
|
246
|
-
}
|
|
247
|
-
// add a microcomponent to a target DOM node
|
|
248
|
-
static add(target, key, element = {}) {
|
|
249
|
-
let node = target;
|
|
250
|
-
// create the _mc property if necessary
|
|
251
|
-
if (!node._mc) {
|
|
252
|
-
node._mc = new MC(target);
|
|
253
|
-
}
|
|
254
|
-
const _mc = node._mc;
|
|
255
|
-
// add the element with the given property key to the _mc property
|
|
256
|
-
if (key.length && !_mc[key]) {
|
|
257
|
-
_mc[key] = element;
|
|
258
|
-
// add attribute if HTMLElement
|
|
259
|
-
if (target instanceof HTMLElement) {
|
|
260
|
-
target.setAttribute("_mc", "");
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
return element;
|
|
264
|
-
}
|
|
265
|
-
// remove a micro component from the DOM
|
|
266
|
-
static remove(target, key) {
|
|
267
|
-
if (!key) return; // silent fail
|
|
268
|
-
const _mc = target?._mc || {};
|
|
269
|
-
// delete the property from the HTMLElement _mc collection
|
|
270
|
-
if (_mc && _mc[key]) {
|
|
271
|
-
delete _mc[key];
|
|
272
|
-
}
|
|
273
|
-
// remove the _mc attribute if the DOM collection is empty
|
|
274
|
-
if (
|
|
275
|
-
!Object.keys(_mc).length &&
|
|
276
|
-
target instanceof HTMLElement &&
|
|
277
|
-
target.hasAttribute("_mc")
|
|
278
|
-
) {
|
|
279
|
-
target.removeAttribute("_mc");
|
|
280
|
-
}
|
|
281
|
-
return;
|
|
282
|
-
}
|
|
283
|
-
// add a microcomponent to the collection
|
|
284
|
-
add(key, element, target) {
|
|
285
|
-
if (this.#_mc[key]) return;
|
|
286
|
-
// if target parameter exists ( a DOM node )
|
|
287
|
-
// you want a top level (public) MC
|
|
288
|
-
if (target) {
|
|
289
|
-
// ... add the new micro component to the DOM node _mc
|
|
290
|
-
MC.add(target, key, element);
|
|
291
|
-
}
|
|
292
|
-
// add the new micro component to the private collection anyway
|
|
293
|
-
this.#_mc[key] = element;
|
|
294
|
-
return element;
|
|
295
|
-
}
|
|
296
|
-
// remove a micro component from the collection
|
|
297
|
-
remove(key, target) {
|
|
298
|
-
const _mc = this.#_mc;
|
|
299
|
-
const t = target;
|
|
300
|
-
// if target parameter exists ( a DOM node )
|
|
301
|
-
// you want to remove a top level (public) MC
|
|
302
|
-
if (target) {
|
|
303
|
-
// ... remove the new micro component from the DOM node _mc
|
|
304
|
-
MC.remove(t, key);
|
|
305
|
-
}
|
|
306
|
-
// remove the new micro component from the private collection anyway
|
|
307
|
-
delete _mc?.[key];
|
|
308
|
-
}
|
|
309
|
-
// return all micro components from the collection, or the searched one
|
|
310
|
-
// in a top level DOM MC, this refers to the inner collection always
|
|
311
|
-
// use MC.siblings() to get the public MCs
|
|
312
|
-
siblings(search = "") {
|
|
313
|
-
const _mc = this.#_mc;
|
|
314
|
-
if (!_mc) return [];
|
|
315
|
-
const result = _mc[search || ""];
|
|
316
|
-
return search && result ? [result] : [...Object.values(_mc)];
|
|
317
|
-
}
|
|
318
|
-
/*
|
|
319
|
-
the following selectors will only work for the DOM top level MCs and return [] otherwise
|
|
320
|
-
*/
|
|
321
|
-
// first anchestor DOM node, all public MCs
|
|
322
|
-
parent(search = "") {
|
|
323
|
-
if (!isDOM(this.#target)) return [];
|
|
324
|
-
return traverseNodes(this.#target.parentNode, search, true);
|
|
325
|
-
}
|
|
326
|
-
// all anchestor DOM nodes, beginning with the closest, all public MCs
|
|
327
|
-
parents(search = "") {
|
|
328
|
-
if (!isDOM(this.#target)) return [];
|
|
329
|
-
return traverseNodes(this.#target.parentNode, search, false);
|
|
330
|
-
}
|
|
331
|
-
// nearest child DOM nodes, all puclic MCs
|
|
332
|
-
children(search = "") {
|
|
333
|
-
if (!isDOM(this.#target)) return [];
|
|
334
|
-
const id = Math.random().toString().replace(".", "");
|
|
335
|
-
const selector = '[_mc]:not([temp_id="' + id + '"] [_mc] [_mc])'; // HOTFIX: minifier or tsc compiler error, dont use backtick string, cuts out blanks
|
|
336
|
-
this.#target.setAttribute("temp_id", id);
|
|
337
|
-
const myDomElements = this.#target.querySelectorAll(selector);
|
|
338
|
-
const mcValues = getMicroComponents([...myDomElements], search);
|
|
339
|
-
this.#target.removeAttribute("temp_id");
|
|
340
|
-
return mcValues;
|
|
341
|
-
}
|
|
342
|
-
// all descendant DOM nodes, all puclic MCs
|
|
343
|
-
descendants(search = "") {
|
|
344
|
-
if (!isDOM(this.#target)) return [];
|
|
345
|
-
const myDomElements = this.#target.querySelectorAll("*[_mc]");
|
|
346
|
-
return getMicroComponents([...myDomElements], search);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
return MC;
|
|
351
|
-
})();
|
|
352
|
-
|
|
353
|
-
function findNodesWithMcAttribute(rootNode, childrenOnly) {
|
|
354
|
-
var result = []; // Array to store nodes with "_mc" attribute
|
|
355
|
-
|
|
356
|
-
var getChildren = childrenOnly === undefined ? true : childrenOnly;
|
|
357
|
-
|
|
358
|
-
function walk(node) {
|
|
359
|
-
// Check if the node has an "_mc" attribute
|
|
360
|
-
if (node.nodeType === 1 && node.getAttribute("_mc") !== null) {
|
|
361
|
-
result.push(node); // Add the node to the result array
|
|
362
|
-
return; // Stop searching this branch
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
// Recursively search child nodes
|
|
366
|
-
var child = node.firstChild;
|
|
367
|
-
while (child) {
|
|
368
|
-
walk(child);
|
|
369
|
-
child = child.nextSibling;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
// Start the tree walk
|
|
374
|
-
walk(rootNode);
|
|
375
|
-
|
|
376
|
-
return result; // Return the array of found nodes
|
|
377
|
-
}
|
|
File without changes
|