Skip to content

Commit

Permalink
pass more args to placement function
Browse files Browse the repository at this point in the history
  • Loading branch information
fat committed Oct 5, 2011
1 parent a2c2634 commit 356227e
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions js/bootstrap-twipsy.js
Expand Up @@ -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':
Expand Down Expand Up @@ -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
* ======================== */

Expand Down

0 comments on commit 356227e

Please sign in to comment.