Add positive and negative testcases for isdomElement
This commit is contained in:
parent
d32db3c312
commit
97121dcf83
2 changed files with 16 additions and 2 deletions
3
index.js
3
index.js
|
|
@ -162,8 +162,9 @@ is.inRange = (x, range) => {
|
|||
};
|
||||
|
||||
is.domElement = x => {
|
||||
const ELEMENT_NODE = 1;
|
||||
const propsToCheck = ['innerHTML', 'ownerDocument', 'style', 'attributes', 'nodeValue'];
|
||||
return is.object(x) && x.nodeType === 1 && is.string(x.nodeName) &&
|
||||
return is.object(x) && x.nodeType === ELEMENT_NODE && is.string(x.nodeName) &&
|
||||
!is.plainObject(x) && propsToCheck.every(prop => prop in x);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue