mirror of
https://github.com/liabru/matter-js.git
synced 2024-12-25 13:39:06 -05:00
refactored Common.isElement
This commit is contained in:
parent
d63b0c25c8
commit
295cffeacf
1 changed files with 0 additions and 8 deletions
|
@ -177,15 +177,7 @@ module.exports = Common;
|
|||
* @return {boolean} True if the object is a HTMLElement, otherwise false
|
||||
*/
|
||||
Common.isElement = function(obj) {
|
||||
// http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object
|
||||
try {
|
||||
return obj instanceof HTMLElement;
|
||||
}
|
||||
catch(e){
|
||||
return (typeof obj==="object") &&
|
||||
(obj.nodeType===1) && (typeof obj.style === "object") &&
|
||||
(typeof obj.ownerDocument ==="object");
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue