0d59fe30 by Michael Richards

Build 0.3.8.

1 parent 38550126
// rivets.js
// version: 0.3.7
// version: 0.3.8
// author: Michael Richards
// license: MIT
(function() {
......@@ -12,7 +12,7 @@
if (!String.prototype.trim) {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, "");
return this.replace(/^\s+|\s+$/g, '');
};
}
......@@ -40,11 +40,11 @@
this.routine = (function() {
switch (this.options.special) {
case "event":
case 'event':
return eventBinding(this.type);
case "class":
case 'class':
return classBinding(this.type);
case "iteration":
case 'iteration':
return iterationBinding(this.type);
default:
return Rivets.routines[this.type] || attributeBinding(this.type);
......@@ -71,11 +71,11 @@
};
Binding.prototype.set = function(value) {
value = value instanceof Function && this.options.special !== "event" ? this.formattedValue(value.call(this.model)) : this.formattedValue(value);
if (this.options.special === "event") {
value = value instanceof Function && this.options.special !== 'event' ? this.formattedValue(value.call(this.model)) : this.formattedValue(value);
if (this.options.special === 'event') {
this.routine(this.el, value, this.currentListener);
return this.currentListener = value;
} else if (this.options.special === "iteration") {
} else if (this.options.special === 'iteration') {
return this.routine(this.el, value, this);
} else {
return this.routine(this.el, value);
......@@ -236,23 +236,23 @@
splitPath = path.split(/\.|:/);
options.formatters = pipes;
model = _this.models[splitPath.shift()];
options.bypass = path.indexOf(":") !== -1;
keypath = splitPath.join();
options.bypass = path.indexOf(':') !== -1;
keypath = splitPath.join('.');
if (model) {
if (dependencies = context.shift()) {
options.dependencies = dependencies.split(/\s+/);
}
if (eventRegExp.test(type)) {
type = type.replace(eventRegExp, '');
options.special = "event";
options.special = 'event';
}
if (classRegExp.test(type)) {
type = type.replace(classRegExp, '');
options.special = "class";
options.special = 'class';
}
if (iterationRegExp.test(type)) {
type = type.replace(iterationRegExp, '');
options.special = "iteration";
options.special = 'iteration';
}
binding = new Rivets.Binding(node, type, model, keypath, options);
binding.view = _this;
......@@ -355,7 +355,7 @@
} else if (window.addEventListener != null) {
return el.addEventListener(event, fn, false);
} else {
event = "on" + event;
event = 'on' + event;
return el.attachEvent(event, fn);
}
};
......@@ -371,7 +371,7 @@
} else if (window.removeEventListener) {
return el.removeEventListener(event, fn, false);
} else {
event = "on" + event;
event = 'on' + event;
return el.detachEvent(event, fn);
}
};
......@@ -402,7 +402,7 @@
elClass = " " + el.className + " ";
hasClass = elClass.indexOf(" " + name + " ") !== -1;
if (!value === hasClass) {
return el.className = value ? "" + el.className + " " + name : elClass.replace(" " + name + " ", " ").trim();
return el.className = value ? "" + el.className + " " + name : elClass.replace(" " + name + " ", ' ').trim();
}
};
};
......
{
"name" : "rivets",
"description" : "Declarative data binding facility.",
"version" : "0.3.7",
"version" : "0.3.8",
"author" : "Michael Richards",
"url" : "http://rivetsjs.com",
"main" : "./lib/rivets.js",
......
# rivets.js
# version : 0.3.7
# version : 0.3.8
# author : Michael Richards
# license : MIT
......