Compile changes from #19.
Showing
1 changed file
with
35 additions
and
1 deletions
... | @@ -6,6 +6,36 @@ | ... | @@ -6,6 +6,36 @@ |
6 | 6 | ||
7 | Rivets = {}; | 7 | Rivets = {}; |
8 | 8 | ||
9 | if (!String.prototype.trim) { | ||
10 | String.prototype.trim = function() { | ||
11 | return this.replace(/^\s\*/, '').replace(/\s\s*$/, ''); | ||
12 | }; | ||
13 | } | ||
14 | |||
15 | if (!Array.prototype.map) { | ||
16 | Array.prototype.map = function(callback) { | ||
17 | var A, O, T, k, len; | ||
18 | if (this === null) { | ||
19 | throw new TypeError("Can't convert " + this + " to object"); | ||
20 | } | ||
21 | O = Object(this); | ||
22 | len = O.length >>> 0; | ||
23 | if (typeof callback !== 'function') { | ||
24 | throw new TypeError("" + callback + " is not a function"); | ||
25 | } | ||
26 | T = arguments[1]; | ||
27 | A = new Array(len); | ||
28 | k = 0; | ||
29 | while (k < len) { | ||
30 | if (k in O) { | ||
31 | A[k] = callbackfn.call(T, O[k], k, O); | ||
32 | } | ||
33 | k++; | ||
34 | } | ||
35 | return A; | ||
36 | }; | ||
37 | } | ||
38 | |||
9 | Rivets.Binding = (function() { | 39 | Rivets.Binding = (function() { |
10 | 40 | ||
11 | function Binding(el, type, model, keypath, formatters) { | 41 | function Binding(el, type, model, keypath, formatters) { |
... | @@ -40,7 +70,11 @@ | ... | @@ -40,7 +70,11 @@ |
40 | this.set(Rivets.config.adapter.read(this.model, this.keypath)); | 70 | this.set(Rivets.config.adapter.read(this.model, this.keypath)); |
41 | } | 71 | } |
42 | if (_ref = this.type, __indexOf.call(bidirectionals, _ref) >= 0) { | 72 | if (_ref = this.type, __indexOf.call(bidirectionals, _ref) >= 0) { |
43 | return this.el.addEventListener('change', this.publish); | 73 | if (window.addEventListener) { |
74 | return this.el.addEventListener('change', this.publish); | ||
75 | } else { | ||
76 | return this.el.attatchEvent('change', this.publish); | ||
77 | } | ||
44 | } | 78 | } |
45 | }; | 79 | }; |
46 | 80 | ... | ... |
-
Please register or sign in to post a comment