052cc70c by Michael Richards

Evaluate function values before running through formatters (unless they're for a…

…n event binding). [Closes #59]
1 parent 2be61616
...@@ -43,7 +43,10 @@ class Rivets.Binding ...@@ -43,7 +43,10 @@ class Rivets.Binding
43 # Sets the value for the binding. This Basically just runs the binding routine 43 # Sets the value for the binding. This Basically just runs the binding routine
44 # with the suplied value formatted. 44 # with the suplied value formatted.
45 set: (value) => 45 set: (value) =>
46 value = @formattedValue value 46 value = if value instanceof Function and @options.special isnt "event"
47 @formattedValue value.call @model
48 else
49 @formattedValue value
47 50
48 if @options.special is "event" 51 if @options.special is "event"
49 @routine @el, value, @currentListener 52 @routine @el, value, @currentListener
...@@ -51,7 +54,6 @@ class Rivets.Binding ...@@ -51,7 +54,6 @@ class Rivets.Binding
51 else if @options.special is "iteration" 54 else if @options.special is "iteration"
52 @routine @el, value, @ 55 @routine @el, value, @
53 else 56 else
54 value = value.call(@model) if value instanceof Function
55 @routine @el, value 57 @routine @el, value
56 58
57 # Subscribes to the model for changes at the specified keypath. Bi-directional 59 # Subscribes to the model for changes at the specified keypath. Bi-directional
......