Build 0.3.8.
Showing
4 changed files
with
18 additions
and
18 deletions
1 | // rivets.js | 1 | // rivets.js |
2 | // version: 0.3.7 | 2 | // version: 0.3.8 |
3 | // author: Michael Richards | 3 | // author: Michael Richards |
4 | // license: MIT | 4 | // license: MIT |
5 | (function() { | 5 | (function() { |
... | @@ -12,7 +12,7 @@ | ... | @@ -12,7 +12,7 @@ |
12 | 12 | ||
13 | if (!String.prototype.trim) { | 13 | if (!String.prototype.trim) { |
14 | String.prototype.trim = function() { | 14 | String.prototype.trim = function() { |
15 | return this.replace(/^\s+|\s+$/g, ""); | 15 | return this.replace(/^\s+|\s+$/g, ''); |
16 | }; | 16 | }; |
17 | } | 17 | } |
18 | 18 | ||
... | @@ -40,11 +40,11 @@ | ... | @@ -40,11 +40,11 @@ |
40 | 40 | ||
41 | this.routine = (function() { | 41 | this.routine = (function() { |
42 | switch (this.options.special) { | 42 | switch (this.options.special) { |
43 | case "event": | 43 | case 'event': |
44 | return eventBinding(this.type); | 44 | return eventBinding(this.type); |
45 | case "class": | 45 | case 'class': |
46 | return classBinding(this.type); | 46 | return classBinding(this.type); |
47 | case "iteration": | 47 | case 'iteration': |
48 | return iterationBinding(this.type); | 48 | return iterationBinding(this.type); |
49 | default: | 49 | default: |
50 | return Rivets.routines[this.type] || attributeBinding(this.type); | 50 | return Rivets.routines[this.type] || attributeBinding(this.type); |
... | @@ -71,11 +71,11 @@ | ... | @@ -71,11 +71,11 @@ |
71 | }; | 71 | }; |
72 | 72 | ||
73 | Binding.prototype.set = function(value) { | 73 | Binding.prototype.set = function(value) { |
74 | value = value instanceof Function && this.options.special !== "event" ? this.formattedValue(value.call(this.model)) : this.formattedValue(value); | 74 | value = value instanceof Function && this.options.special !== 'event' ? this.formattedValue(value.call(this.model)) : this.formattedValue(value); |
75 | if (this.options.special === "event") { | 75 | if (this.options.special === 'event') { |
76 | this.routine(this.el, value, this.currentListener); | 76 | this.routine(this.el, value, this.currentListener); |
77 | return this.currentListener = value; | 77 | return this.currentListener = value; |
78 | } else if (this.options.special === "iteration") { | 78 | } else if (this.options.special === 'iteration') { |
79 | return this.routine(this.el, value, this); | 79 | return this.routine(this.el, value, this); |
80 | } else { | 80 | } else { |
81 | return this.routine(this.el, value); | 81 | return this.routine(this.el, value); |
... | @@ -236,23 +236,23 @@ | ... | @@ -236,23 +236,23 @@ |
236 | splitPath = path.split(/\.|:/); | 236 | splitPath = path.split(/\.|:/); |
237 | options.formatters = pipes; | 237 | options.formatters = pipes; |
238 | model = _this.models[splitPath.shift()]; | 238 | model = _this.models[splitPath.shift()]; |
239 | options.bypass = path.indexOf(":") !== -1; | 239 | options.bypass = path.indexOf(':') !== -1; |
240 | keypath = splitPath.join(); | 240 | keypath = splitPath.join('.'); |
241 | if (model) { | 241 | if (model) { |
242 | if (dependencies = context.shift()) { | 242 | if (dependencies = context.shift()) { |
243 | options.dependencies = dependencies.split(/\s+/); | 243 | options.dependencies = dependencies.split(/\s+/); |
244 | } | 244 | } |
245 | if (eventRegExp.test(type)) { | 245 | if (eventRegExp.test(type)) { |
246 | type = type.replace(eventRegExp, ''); | 246 | type = type.replace(eventRegExp, ''); |
247 | options.special = "event"; | 247 | options.special = 'event'; |
248 | } | 248 | } |
249 | if (classRegExp.test(type)) { | 249 | if (classRegExp.test(type)) { |
250 | type = type.replace(classRegExp, ''); | 250 | type = type.replace(classRegExp, ''); |
251 | options.special = "class"; | 251 | options.special = 'class'; |
252 | } | 252 | } |
253 | if (iterationRegExp.test(type)) { | 253 | if (iterationRegExp.test(type)) { |
254 | type = type.replace(iterationRegExp, ''); | 254 | type = type.replace(iterationRegExp, ''); |
255 | options.special = "iteration"; | 255 | options.special = 'iteration'; |
256 | } | 256 | } |
257 | binding = new Rivets.Binding(node, type, model, keypath, options); | 257 | binding = new Rivets.Binding(node, type, model, keypath, options); |
258 | binding.view = _this; | 258 | binding.view = _this; |
... | @@ -355,7 +355,7 @@ | ... | @@ -355,7 +355,7 @@ |
355 | } else if (window.addEventListener != null) { | 355 | } else if (window.addEventListener != null) { |
356 | return el.addEventListener(event, fn, false); | 356 | return el.addEventListener(event, fn, false); |
357 | } else { | 357 | } else { |
358 | event = "on" + event; | 358 | event = 'on' + event; |
359 | return el.attachEvent(event, fn); | 359 | return el.attachEvent(event, fn); |
360 | } | 360 | } |
361 | }; | 361 | }; |
... | @@ -371,7 +371,7 @@ | ... | @@ -371,7 +371,7 @@ |
371 | } else if (window.removeEventListener) { | 371 | } else if (window.removeEventListener) { |
372 | return el.removeEventListener(event, fn, false); | 372 | return el.removeEventListener(event, fn, false); |
373 | } else { | 373 | } else { |
374 | event = "on" + event; | 374 | event = 'on' + event; |
375 | return el.detachEvent(event, fn); | 375 | return el.detachEvent(event, fn); |
376 | } | 376 | } |
377 | }; | 377 | }; |
... | @@ -402,7 +402,7 @@ | ... | @@ -402,7 +402,7 @@ |
402 | elClass = " " + el.className + " "; | 402 | elClass = " " + el.className + " "; |
403 | hasClass = elClass.indexOf(" " + name + " ") !== -1; | 403 | hasClass = elClass.indexOf(" " + name + " ") !== -1; |
404 | if (!value === hasClass) { | 404 | if (!value === hasClass) { |
405 | return el.className = value ? "" + el.className + " " + name : elClass.replace(" " + name + " ", " ").trim(); | 405 | return el.className = value ? "" + el.className + " " + name : elClass.replace(" " + name + " ", ' ').trim(); |
406 | } | 406 | } |
407 | }; | 407 | }; |
408 | }; | 408 | }; | ... | ... |
This diff is collapsed.
Click to expand it.
1 | { | 1 | { |
2 | "name" : "rivets", | 2 | "name" : "rivets", |
3 | "description" : "Declarative data binding facility.", | 3 | "description" : "Declarative data binding facility.", |
4 | "version" : "0.3.7", | 4 | "version" : "0.3.8", |
5 | "author" : "Michael Richards", | 5 | "author" : "Michael Richards", |
6 | "url" : "http://rivetsjs.com", | 6 | "url" : "http://rivetsjs.com", |
7 | "main" : "./lib/rivets.js", | 7 | "main" : "./lib/rivets.js", | ... | ... |
-
Please register or sign in to post a comment