@domql/element
Advanced tools
Comparing version 2.5.100 to 2.5.101
@@ -28,2 +28,3 @@ "use strict"; | ||
lookdown: () => lookdown, | ||
lookdownAll: () => lookdownAll, | ||
lookup: () => lookup, | ||
@@ -99,2 +100,20 @@ nextElement: () => nextElement, | ||
}; | ||
const lookdownAll = function(param, results = []) { | ||
const el = this; | ||
const { __ref: ref } = el; | ||
const children = ref.__children; | ||
for (let i = 0; i < children.length; i++) { | ||
const v = children[i]; | ||
const childElem = el[v]; | ||
if (v === param) | ||
results.push(childElem); | ||
else if ((0, import_utils.isFunction)(param)) { | ||
const exec = param(childElem, childElem.state, childElem.context); | ||
if (childElem.state && exec) | ||
results.push(childElem); | ||
} | ||
childElem == null ? void 0 : childElem.lookdownAll(param, results); | ||
} | ||
return results.length ? results : null; | ||
}; | ||
const remove = function() { | ||
@@ -211,2 +230,3 @@ const element = this; | ||
"lookdown", | ||
"lookdownAll", | ||
"spotByPath", | ||
@@ -213,0 +233,0 @@ "keys", |
@@ -49,2 +49,3 @@ "use strict"; | ||
lookdown: import__.lookdown.bind(element), | ||
lookdownAll: import__.lookdownAll.bind(element), | ||
spotByPath: import__.spotByPath.bind(element), | ||
@@ -51,0 +52,0 @@ parse: import__.parse.bind(element), |
@@ -65,2 +65,3 @@ "use strict"; | ||
lookdown: {}, | ||
lookdownAll: {}, | ||
spotByPath: {}, | ||
@@ -67,0 +68,0 @@ keys: {}, |
@@ -68,2 +68,22 @@ 'use strict' | ||
export const lookdownAll = function (param, results = []) { | ||
const el = this | ||
const { __ref: ref } = el | ||
const children = ref.__children | ||
for (let i = 0; i < children.length; i++) { | ||
const v = children[i] | ||
const childElem = el[v] | ||
if (v === param) results.push(childElem) | ||
else if (isFunction(param)) { | ||
const exec = param(childElem, childElem.state, childElem.context) | ||
if (childElem.state && exec) results.push(childElem) | ||
} | ||
childElem?.lookdownAll(param, results) | ||
} | ||
return results.length ? results : null | ||
} | ||
export const remove = function () { | ||
@@ -187,2 +207,3 @@ const element = this | ||
'lookdown', | ||
'lookdownAll', | ||
'spotByPath', | ||
@@ -189,0 +210,0 @@ 'keys', |
@@ -11,2 +11,3 @@ 'use strict' | ||
lookdown, | ||
lookdownAll, | ||
setProps, | ||
@@ -35,2 +36,3 @@ remove, | ||
lookdown: lookdown.bind(element), | ||
lookdownAll: lookdownAll.bind(element), | ||
spotByPath: spotByPath.bind(element), | ||
@@ -37,0 +39,0 @@ parse: parse.bind(element), |
@@ -49,2 +49,3 @@ 'use strict' | ||
lookdown: {}, | ||
lookdownAll: {}, | ||
spotByPath: {}, | ||
@@ -51,0 +52,0 @@ keys: {}, |
{ | ||
"name": "@domql/element", | ||
"version": "2.5.100", | ||
"version": "2.5.101", | ||
"license": "MIT", | ||
@@ -34,3 +34,3 @@ "type": "module", | ||
}, | ||
"gitHead": "38b74a597edc2f9454a81b892505282a944fd5b9", | ||
"gitHead": "5a5e8988f25e9a77e44596d9fd23e8a00b725685", | ||
"devDependencies": { | ||
@@ -37,0 +37,0 @@ "@babel/core": "^7.12.0" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
187461
5072