f6c70967 by Michael Richards

Build 0.3.9.

1 parent d9641ee9
1 // rivets.js 1 // rivets.js
2 // version: 0.3.8 2 // version: 0.3.9
3 // author: Michael Richards 3 // author: Michael Richards
4 // license: MIT 4 // license: MIT
5 (function() { 5 (function() {
...@@ -73,8 +73,7 @@ ...@@ -73,8 +73,7 @@
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 return this.currentListener = this.routine(this.el, this.model, value, this.currentListener);
77 return this.currentListener = value;
78 } else if (this.options.special === 'iteration') { 77 } else if (this.options.special === 'iteration') {
79 return this.routine(this.el, value, this); 78 return this.routine(this.el, value, this);
80 } else { 79 } else {
...@@ -344,20 +343,25 @@ ...@@ -344,20 +343,25 @@
344 343
345 })(); 344 })();
346 345
347 bindEvent = function(el, event, fn) { 346 bindEvent = function(el, event, handler, context) {
347 var fn;
348 fn = function(e) {
349 return handler.call(context, e);
350 };
348 if (window.jQuery != null) { 351 if (window.jQuery != null) {
349 el = jQuery(el); 352 el = jQuery(el);
350 if (el.on != null) { 353 if (el.on != null) {
351 return el.on(event, fn); 354 el.on(event, fn);
352 } else { 355 } else {
353 return el.bind(event, fn); 356 el.bind(event, fn);
354 } 357 }
355 } else if (window.addEventListener != null) { 358 } else if (window.addEventListener != null) {
356 return el.addEventListener(event, fn, false); 359 el.addEventListener(event, fn, false);
357 } else { 360 } else {
358 event = 'on' + event; 361 event = 'on' + event;
359 return el.attachEvent(event, fn); 362 el.attachEvent(event, fn);
360 } 363 }
364 return fn;
361 }; 365 };
362 366
363 unbindEvent = function(el, event, fn) { 367 unbindEvent = function(el, event, fn) {
...@@ -386,13 +390,11 @@ ...@@ -386,13 +390,11 @@
386 }; 390 };
387 391
388 eventBinding = function(event) { 392 eventBinding = function(event) {
389 return function(el, bind, unbind) { 393 return function(el, context, bind, unbind) {
390 if (bind) {
391 bindEvent(el, event, bind);
392 }
393 if (unbind) { 394 if (unbind) {
394 return unbindEvent(el, event, unbind); 395 unbindEvent(el, event, unbind);
395 } 396 }
397 return bindEvent(el, event, bind, context);
396 }; 398 };
397 }; 399 };
398 400
......
1 { 1 {
2 "name" : "rivets", 2 "name" : "rivets",
3 "description" : "Declarative data binding facility.", 3 "description" : "Declarative data binding facility.",
4 "version" : "0.3.8", 4 "version" : "0.3.9",
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",
......
1 # rivets.js 1 # rivets.js
2 # version : 0.3.8 2 # version : 0.3.9
3 # author : Michael Richards 3 # author : Michael Richards
4 # license : MIT 4 # license : MIT
5 5
......