3 Star 54 Fork 14

Yaohaixiao / dom.js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
getLastChild.js 640 Bytes
一键复制 编辑 原始数据 按行查看 历史
import isString from './utils/types/isString'
import isFunction from './utils/types/isFunction'
import isElement from './isElement'
import getEl from './getEl'
import getLastChildBy from './getLastChildBy'
/**
* @method getLastChild
* @since 1.10.0
* @param {HTMLElement|String} el
* @param {Function} [filter]
* @return {HTMLElement|ChildNode|null}
*/
const getLastChild = (el, filter) => {
const $el = isString(el) ? getEl(el) : isElement(el) ? el : null
if (!$el) {
return null
}
if (isFunction(filter)) {
return getLastChildBy($el, filter)
} else {
return $el.lastChild
}
}
export default getLastChild
JavaScript
1
https://gitee.com/yaohaixiao/dom.js.git
git@gitee.com:yaohaixiao/dom.js.git
yaohaixiao
dom.js
dom.js
main

搜索帮助