From 7f7282607babc7a4cd1dc4862b158be79b2e148c Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Wed, 3 Apr 2013 21:32:06 -0400 Subject: [PATCH] refactor isElement --- component.json | 2 +- draggabilly.js | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/component.json b/component.json index 5246416..ac1aead 100644 --- a/component.json +++ b/component.json @@ -1,7 +1,7 @@ { "name": "draggabilly", "main": "./draggabilly.js", - "version": "1.0.0", + "version": "1.0.1", "dependencies": { "classie": "desandro/classie", "eventEmitter": ">=3", diff --git a/draggabilly.js b/draggabilly.js index f62292d..37b3470 100644 --- a/draggabilly.js +++ b/draggabilly.js @@ -1,5 +1,5 @@ /*! - * Draggabilly v1.0.0 + * Draggabilly v1.0.1 * Make that shiz draggable * http://draggabilly.desandro.com */ @@ -41,12 +41,14 @@ var getStyle = defView && defView.getComputedStyle ? // http://stackoverflow.com/a/384380/182183 -function isElement(o){ - return ( - typeof HTMLElement === "object" ? o instanceof HTMLElement : //DOM2 - o && typeof o === "object" && o.nodeType === 1 && typeof o.nodeName==="string" - ); -} +var isElement = ( typeof HTMLElement === 'object' ) ? + function isElementDOM2( obj ) { + return obj instanceof HTMLElement; + } : + function isElementQuirky( obj ) { + return obj && typeof obj === 'object' && + obj.nodeType === 1 && typeof obj.nodeName === 'string'; + }; // -------------------------- requestAnimationFrame -------------------------- //