Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
usedComponents () {
let tags = []
DomUtils.find((el) => {
let { name, attribs = {} } = el
// 记录所有非原生组件名
if (name && !isNativeTag(name)) {
tags.push(name)
}
let attrKeys = Object.keys(attribs)
/**
* 使用自定义组件是抽象组件
*/
if (/generic:/.test(attrKeys.join(';'))) {
attrKeys.forEach(key => {
/generic:/.test(key) && tags.push(attribs[key])
})
function tocObj(str, options = {}) {
options = Object.assign({
min_depth: 1,
max_depth: 6
}, options);
const headingsSelector = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].slice(options.min_depth - 1, options.max_depth).join(',');
const dom = parseHtml(str);
const headings = DomUtils.find(el => headingsSelector.includes(el.tagName), dom, true);
const result = [];
if (!headings.length) return result;
for (const el of headings) {
const level = +el.name[1];
const id = getId(el);
const text = escapeHTML(DomUtils.getText(el));
result.push({ text, id, level });
}
return result;
}
const scriptElementExists = function(dom) {
return DomUtils.find(function(element) {
return element.type === 'script' && element.attribs.src === 'cordova.js';
}, dom, true, 1).length > 0;
};
const getBodyElement = function(dom) {
return DomUtils.find(function(element) {
return element.type === 'tag' && element.name === 'body';
}, dom, true, 1)[0];
};
module.exports.find = function find (content, test) {
let dom = parseDOM(content, {
recognizeSelfClosing: true,
lowerCaseAttributeNames: false
})
DomUtils.find(test, dom, true)
return dom
}
static find (content, callback) {
let dom = parseDOM(content, {
recognizeSelfClosing: true,
lowerCaseAttributeNames: false
})
DomUtils.find(callback, dom, true)
return dom
}