From 4fe86927cc0dbfa9755f88cd501dd9dfa224c988 Mon Sep 17 00:00:00 2001 From: Ryan Van Etten Date: Thu, 21 Mar 2013 01:28:27 -0400 Subject: [PATCH] In .rectangle: simplify nix via arguments.length. --- verge.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/verge.js b/verge.js index a6e0c99..8371cba 100644 --- a/verge.js +++ b/verge.js @@ -108,14 +108,13 @@ * @since 1.0.0 * @param {Object|Array} el DOM element or collection (defaults to first item) * @param {number=} cushion +/- pixel amount to act as a cushion around the viewport - * @param {Object=} nix voids cushion when scoped like arr.map(verge.rectangle, arr) - * @return {Object|undefined} + * @return {Object|boolean} */ - function rectangle(el, cushion, nix) { + function rectangle(el, cushion) { var o = {}; el && !el.nodeType && (el = el[0]); if (!el || 1 !== el.nodeType) { return false; } - cushion = typeof cushion == 'number' && (null == nix || this !== nix) && cushion || 0; + cushion = typeof cushion == 'number' && 2 == arguments.length && cushion || 0; el = el.getBoundingClientRect(); // read-only o['width'] = (o['right'] = el['right'] + cushion) - (o['left'] = el['left'] - cushion); o['height'] = (o['bottom'] = el['bottom'] + cushion) - (o['top'] = el['top'] - cushion);