abeca6f2 by Michael Richards

Build 0.4.3.

1 parent ad0df3fb
......@@ -2,7 +2,7 @@
"name": "rivets",
"repo": "mikeric/rivets",
"description": "Declarative data binding facility.",
"version": "0.4.2",
"version": "0.4.3",
"keywords": ["data binding", "template"],
"scripts": ["lib/rivets.js"],
"main": "lib/rivets.js",
......
// rivets.js
// version: 0.4.2
// version: 0.4.3
// author: Michael Richards
// license: MIT
(function() {
......@@ -61,13 +61,18 @@
}
Binding.prototype.formattedValue = function(value) {
var args, formatter, id, _i, _len, _ref, _ref1, _ref2, _ref3;
var args, formatter, id, _i, _len, _ref;
_ref = this.formatters;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
formatter = _ref[_i];
args = formatter.split(/\s+/);
id = args.shift();
value = this.model[id] instanceof Function ? (_ref1 = this.model)[id].apply(_ref1, [value].concat(__slice.call(args))) : Rivets.formatters[id] ? Rivets.formatters[id].read instanceof Function ? (_ref2 = Rivets.formatters[id]).read.apply(_ref2, [value].concat(__slice.call(args))) : Rivets.formatters[id] instanceof Function ? (_ref3 = Rivets.formatters)[id].apply(_ref3, [value].concat(__slice.call(args))) : value : value;
formatter = this.model[id] instanceof Function ? this.model[id] : Rivets.formatters[id];
if ((formatter != null ? formatter.read : void 0) instanceof Function) {
value = formatter.read.apply(formatter, [value].concat(__slice.call(args)));
} else if (formatter instanceof Function) {
value = formatter.apply(null, [value].concat(__slice.call(args)));
}
}
return value;
};
......@@ -83,23 +88,18 @@
};
Binding.prototype.publish = function() {
var args, formatter, i, id, value, _ref;
var args, formatter, id, value, _i, _len, _ref, _ref1, _ref2;
value = getInputValue(this.el);
if (this.formatters) {
i = this.formatters.length - 1;
while (i > -1) {
formatter = this.formatters[i];
_ref = this.formatters.slice(0).reverse();
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
formatter = _ref[_i];
args = formatter.split(/\s+/);
id = args.shift();
if (Rivets.formatters[id] && Rivets.formatters[id].publish) {
value = (_ref = Rivets.formatters[id]).publish.apply(_ref, [value].concat(__slice.call(args)));
}
i--;
if ((_ref1 = Rivets.formatters[id]) != null ? _ref1.publish : void 0) {
value = (_ref2 = Rivets.formatters[id]).publish.apply(_ref2, [value].concat(__slice.call(args)));
}
}
if (value) {
return Rivets.config.adapter.publish(this.model, this.keypath, value);
}
};
Binding.prototype.bind = function() {
......@@ -193,12 +193,12 @@
};
View.prototype.build = function() {
var bindingRegExp, el, node, parseNode, skipNodes, _i, _j, _len, _len1, _ref, _ref1,
var bindingRegExp, el, node, parse, skipNodes, _i, _j, _len, _len1, _ref, _ref1,
_this = this;
this.bindings = [];
skipNodes = [];
bindingRegExp = this.bindingRegExp();
parseNode = function(node) {
parse = function(node) {
var attribute, attributes, binder, binding, context, ctx, dependencies, identifier, keypath, model, n, options, path, pipe, pipes, regexp, splitPath, type, value, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3;
if (__indexOf.call(skipNodes, node) < 0) {
_ref = node.attributes;
......@@ -284,11 +284,13 @@
_ref = this.els;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
el = _ref[_i];
parseNode(el);
parse(el);
_ref1 = el.getElementsByTagName('*');
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
node = _ref1[_j];
parseNode(node);
if (node.attributes != null) {
parse(node);
}
}
}
};
......
{
"name" : "rivets",
"description" : "Declarative data binding facility.",
"version" : "0.4.2",
"version" : "0.4.3",
"author" : "Michael Richards",
"url" : "http://rivetsjs.com",
"main" : "./lib/rivets.js",
......
# rivets.js
# version : 0.4.2
# version : 0.4.3
# author : Michael Richards
# license : MIT
......