68e23851 by Michael Richards

Build 0.3.1.

1 parent feb9426d
// rivets.js
// version: 0.3.0
// version: 0.3.1
// author: Michael Richards
// license: MIT
(function() {
......@@ -51,7 +51,7 @@
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.config.formatters[id] ? (_ref2 = Rivets.config.formatters)[id].apply(_ref2, [value].concat(__slice.call(args))) : void 0;
value = this.model[id] instanceof Function ? (_ref1 = this.model)[id].apply(_ref1, [value].concat(__slice.call(args))) : Rivets.formatters[id] ? (_ref2 = Rivets.formatters)[id].apply(_ref2, [value].concat(__slice.call(args))) : void 0;
}
return value;
};
......@@ -158,7 +158,7 @@
bindingRegExp = this.bindingRegExp();
eventRegExp = /^on-/;
parseNode = function(node) {
var attribute, context, ctx, dependencies, keypath, model, options, path, pipe, pipes, type, _i, _len, _ref, _results;
var attribute, context, ctx, dependencies, keypath, model, options, path, pipe, pipes, splitPath, type, _i, _len, _ref, _results;
_ref = node.attributes;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
......@@ -186,11 +186,12 @@
}
return _results1;
})();
path = context.shift().split(/(\.|:)/);
path = context.shift();
splitPath = path.split(/\.|:/);
options.formatters = pipes;
model = _this.models[path.shift()];
options.bypass = path.shift() === ':';
keypath = path.join();
model = _this.models[splitPath.shift()];
options.bypass = path.indexOf(":") !== -1;
keypath = splitPath.join();
if (dependencies = context.shift()) {
options.dependencies = dependencies.split(/\s+/);
}
......@@ -252,16 +253,18 @@
bindEvent = function(el, event, fn) {
if (window.addEventListener) {
return el.addEventListener(event, fn);
return el.addEventListener(event, fn, false);
} else {
event = "on" + event;
return el.attachEvent(event, fn);
}
};
unbindEvent = function(el, event, fn) {
if (window.removeEventListener) {
return el.removeEventListener(event, fn);
return el.removeEventListener(event, fn, false);
} else {
event = "on" + event;
return el.detachEvent(event, fn);
}
};
......@@ -339,12 +342,14 @@
};
Rivets.config = {
preloadData: true,
formatters: {}
preloadData: true
};
Rivets.formatters = {};
rivets = {
routines: Rivets.routines,
formatters: Rivets.formatters,
config: Rivets.config,
configure: function(options) {
var property, value, _results;
......
{
"name" : "rivets",
"description" : "Declarative data binding facility.",
"version" : "0.3.0",
"version" : "0.3.1",
"author" : "Michael Richards",
"url" : "http://rivetsjs.com",
"main" : "./lib/rivets.js",
......
# rivets.js
# version : 0.3.0
# version : 0.3.1
# author : Michael Richards
# license : MIT
......