Permalink
Browse files

Handle false value in function directives

  • Loading branch information...
pure committed Jul 16, 2011
1 parent 3312f81 commit 317809a25653195bacb38f6b34a92929e1db1d6f
Showing with 24 additions and 20 deletions.
  1. +8 −4 libs/pure.js
  2. +16 −16 libs/pure_min.js
View
@@ -7,7 +7,7 @@
Copyright (c) 2011 Michael Cvilic - BeeBole.com
Thanks to Rog Peppe for the functional JS jump
- revision: 2.71
+ revision: 2.72
*/
var $p, pure = $p = function(){
@@ -182,9 +182,13 @@ $p.core = function(sel, ctxt, plugins){
// parse a data selector and return a function that
// can traverse the data accordingly, given a context.
- function dataselectfn(sel){
- if(typeof(sel) === 'function'){
- return sel;
+ function dataselectfn (sel){
+ if( typeof(sel) === 'function' ){
+ //handle false values in function directive
+ return function ( ctxt ){
+ var r = sel.call( ctxt.item || ctxt.context || ctxt, ctxt );
+ return !r && r !== 0 ? '' : r;
+ };
}
//check for a valid js variable name with hyphen(for properties only), $, _ and :
var m = sel.match(/^[a-zA-Z\$_\@][\w\$:-]*(\.[\w\$:-]*[^\.])*$/);
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 317809a

Please sign in to comment.