代码拉取完成,页面将自动刷新
import getFirstChildBy from './getFirstChildBy'
import getNextSiblingBy from './getNextSiblingBy'
/**
* 通过过滤函数获取指定 DOM 元素下的 childNode 元素
* ========================================================================
* @method getChildrenBy
* @since 1.10.0
* @param {HTMLElement} el
* @param {Function} filter
* @return {HTMLElement[]|*[]}
*/
const getChildrenBy = (el, filter) => {
const child = getFirstChildBy(el, filter)
const children = child ? [child] : []
let $next = getNextSiblingBy(child, filter)
while ($next) {
children.push($next)
$next = getNextSiblingBy(child, filter)
}
return children
}
export default getChildrenBy
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。