Browse Source

closure fake selector

Ivan Asmer 7 years ago
parent
commit
83b0286663
1 changed files with 6 additions and 1 deletions
  1. 6 1
      static/nb.js

+ 6 - 1
static/nb.js

@@ -67,7 +67,12 @@ function nbInit(a,b){
             var items = searchElement(root, selector);
             for (var i=0,item=items[i];i<items.length;i++,item=items[i]){
                 if (direction == "write" &&  Array.isArray($s[selector]) && (item.children.length == 0 || (items.length == $s[selector].length && items.length > 1))){
-                    callback(item, $s, selector, $s[selector][i]);
+                    if (closure){
+                        callback(item, $s, selector, $s[selector]);
+                    }
+                    else {
+                        callback(item, $s, selector, $s[selector][i]);
+                    }
                 }
                 else {
                     var res = callback(item, $s, selector);