abbott-methods
Version:
abbott,methods,method,functions,function
15 lines (14 loc) • 381 B
text/typescript
/**
* @description 是否HTMLElement类型
* @param {*} typeValue
* @returns {Boolean}
*/
export const typeHTMLElement = (typeValue: any): boolean => {
const d = document.createElement('div')
try {
d.appendChild(typeValue.cloneNode(true))
return typeValue.nodeType === 1
} catch (e) {
return typeValue === window || typeValue === document
}
}