ff37fe10 by Michael Richards

Compile changes from #19.

1 parent 48ca4e77
......@@ -6,6 +6,36 @@
Rivets = {};
if (!String.prototype.trim) {
String.prototype.trim = function() {
return this.replace(/^\s\*/, '').replace(/\s\s*$/, '');
};
}
if (!Array.prototype.map) {
Array.prototype.map = function(callback) {
var A, O, T, k, len;
if (this === null) {
throw new TypeError("Can't convert " + this + " to object");
}
O = Object(this);
len = O.length >>> 0;
if (typeof callback !== 'function') {
throw new TypeError("" + callback + " is not a function");
}
T = arguments[1];
A = new Array(len);
k = 0;
while (k < len) {
if (k in O) {
A[k] = callbackfn.call(T, O[k], k, O);
}
k++;
}
return A;
};
}
Rivets.Binding = (function() {
function Binding(el, type, model, keypath, formatters) {
......@@ -40,7 +70,11 @@
this.set(Rivets.config.adapter.read(this.model, this.keypath));
}
if (_ref = this.type, __indexOf.call(bidirectionals, _ref) >= 0) {
return this.el.addEventListener('change', this.publish);
if (window.addEventListener) {
return this.el.addEventListener('change', this.publish);
} else {
return this.el.attatchEvent('change', this.publish);
}
}
};
......