Skip to content

Commit

Permalink
Correct scope for visible and make sure visible can be string like ot…
Browse files Browse the repository at this point in the history
…her callbacks
  • Loading branch information
andriijas committed Dec 11, 2012
1 parent 5f9a2da commit e70432c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backbone.stickit.js
Expand Up @@ -102,7 +102,7 @@
// view element.
if (config.visible) {
visibleCb = function() {
updateVisibleBindEl($el, getVal(model, modelAttr, config, self), modelAttr, config, this);
updateVisibleBindEl($el, getVal(model, modelAttr, config, self), modelAttr, config, self);
};
observeModelEvent('change:' + modelAttr, visibleCb);
visibleCb();
Expand Down Expand Up @@ -231,7 +231,7 @@
var visible = config.visible, visibleFn = config.visibleFn, isVisible = !!val;

// If `visible` is a function then it should return a boolean result to show/hide.
if (_.isFunction(visible)) isVisible = applyViewFn(context, visible, val, attrName);
if (_.isFunction(visible) || _.isString(visible)) isVisible = applyViewFn(context, visible, val, attrName);

// Either use the custom `visibleFn`, if provided, or execute a standard jQuery show/hide.
if (visibleFn) applyViewFn(context, visibleFn, $el, isVisible, attrName);
Expand Down

0 comments on commit e70432c

Please sign in to comment.