Add positive and negative testcases for isdomElement

This commit is contained in:
Melvin Philips 2017-10-05 13:39:34 -07:00
parent d32db3c312
commit 97121dcf83
2 changed files with 16 additions and 2 deletions

View file

@ -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);
};