MCPcopy Create free account
hub / github.com/Barrior/JParticles / isElement

Function isElement

src/utils/checking.ts:100–105  ·  view source on GitHub ↗
(value: any)

Source from the content-addressed store, hash-verified

98 * 检测 value 是否为 DOM 元素
99 */
100export function isElement(value: any): boolean {
101 // 1、document(nodeType: 9) 元素不能判断为 element,因为它没有很多 element 该有的属性,
102 // 比如:getComputedStyle 获取不到它的宽高,就会报错。
103 // 2、当传入 0 的时候,不加 !! 会返回 0,而不是 Boolean 值
104 return !!(value && value.nodeType === 1)
105}

Callers 4

checking.spec.tsFile · 0.90
optionsNormalizeMethod · 0.90
checkElementRemovedFunction · 0.90
constructorFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected