e0044f13 by Nicklas Ansman Giertz

Avoid unnecessary return values

1 parent 67c5564b
......@@ -161,7 +161,7 @@
};
View.prototype.build = function() {
var bindingRegExp, el, eventRegExp, iterationRegExp, iterator, node, parseNode, skipNodes, _i, _len, _ref, _results,
var bindingRegExp, el, eventRegExp, iterationRegExp, iterator, node, parseNode, skipNodes, _i, _j, _len, _len1, _ref, _ref1,
_this = this;
this.bindings = [];
skipNodes = [];
......@@ -170,7 +170,7 @@
eventRegExp = /^on-/;
iterationRegExp = /^each-/;
parseNode = function(node) {
var a, attribute, binding, context, ctx, dependencies, keypath, model, n, options, path, pipe, pipes, splitPath, type, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _results;
var a, attribute, binding, context, ctx, dependencies, keypath, model, n, options, path, pipe, pipes, splitPath, type, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2;
if (__indexOf.call(skipNodes, node) < 0) {
_ref = node.attributes;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
......@@ -190,31 +190,30 @@
}
}
_ref2 = iterator || node.attributes;
_results = [];
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
attribute = _ref2[_k];
if (bindingRegExp.test(attribute.name)) {
options = {};
type = attribute.name.replace(bindingRegExp, '');
pipes = (function() {
var _l, _len3, _ref3, _results1;
var _l, _len3, _ref3, _results;
_ref3 = attribute.value.split('|');
_results1 = [];
_results = [];
for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
pipe = _ref3[_l];
_results1.push(pipe.trim());
_results.push(pipe.trim());
}
return _results1;
return _results;
})();
context = (function() {
var _l, _len3, _ref3, _results1;
var _l, _len3, _ref3, _results;
_ref3 = pipes.shift().split('>');
_results1 = [];
_results = [];
for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
ctx = _ref3[_l];
_results1.push(ctx.trim());
_results.push(ctx.trim());
}
return _results1;
return _results;
})();
path = context.shift();
splitPath = path.split(/\.|:/);
......@@ -244,31 +243,21 @@
a = iterator[_l];
node.removeAttribute(a.name);
}
_results.push(iterator = null);
} else {
_results.push(void 0);
iterator = null;
}
}
return _results;
}
};
_ref = this.els;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
el = _ref[_i];
parseNode(el);
_results.push((function() {
var _j, _len1, _ref1, _results1;
_ref1 = el.getElementsByTagName('*');
_results1 = [];
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
node = _ref1[_j];
_results1.push(parseNode(node));
parseNode(node);
}
return _results1;
})());
}
return _results;
};
View.prototype.bind = function() {
......@@ -436,16 +425,14 @@
formatters: Rivets.formatters,
config: Rivets.config,
configure: function(options) {
var property, value, _results;
var property, value;
if (options == null) {
options = {};
}
_results = [];
for (property in options) {
value = options[property];
_results.push(Rivets.config[property] = value);
Rivets.config[property] = value;
}
return _results;
},
bind: function(el, models) {
var view;
......
......@@ -165,10 +165,12 @@ class Rivets.View
if iterator
node.removeAttribute(a.name) for a in iterator
iterator = null
return
for el in @els
parseNode el
parseNode node for node in el.getElementsByTagName '*'
return
# Binds all of the current bindings for this view.
bind: =>
......@@ -291,6 +293,7 @@ rivets =
configure: (options={}) ->
for property, value of options
Rivets.config[property] = value
return
# Binds a set of model objects to a parent DOM element. Returns a Rivets.View
# instance.
......