From 356227ef506a34f0f5b42076bd776474b3830e9c Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Tue, 4 Oct 2011 22:56:23 -0700 Subject: [PATCH] pass more args to placement function --- js/bootstrap-twipsy.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/js/bootstrap-twipsy.js b/js/bootstrap-twipsy.js index 0144c48158..97cf47f46b 100644 --- a/js/bootstrap-twipsy.js +++ b/js/bootstrap-twipsy.js @@ -90,7 +90,8 @@ actualWidth = $tip[0].offsetWidth actualHeight = $tip[0].offsetHeight - placement = _.maybeCall(this.options.placement, this.$element[0]) + + placement = maybeCall(this.options.placement, this, [ $tip[0], this.$element[0] ]) switch (placement) { case 'below': @@ -193,15 +194,10 @@ /* TWIPSY PRIVATE METHODS * ====================== */ - var _ = { - - maybeCall: function ( thing, ctx ) { - return (typeof thing == 'function') ? (thing.call(ctx)) : thing - } - + function maybeCall ( thing, ctx, args ) { + return typeof thing == 'function' ? thing.apply(ctx, args) : thing } - /* TWIPSY PLUGIN DEFINITION * ======================== */