51018f8d by Michael Richards

Clean up the reverse formatter loop in publish and remove the value condition at…

… the end. [Closes #97]
1 parent babbf49a
......@@ -70,17 +70,14 @@ class Rivets.Binding
# Publishes the value currently set on the input element back to the model.
publish: =>
value = getInputValue @el
if @formatters
i = @formatters.length-1
while(i > -1)
formatter = @formatters[i]
for formatter in @formatters.slice(0).reverse()
args = formatter.split /\s+/
id = args.shift()
# only re-assign if there is a two-way formatter.
if Rivets.formatters[id] and Rivets.formatters[id].publish
if Rivets.formatters[id]?.publish
value = Rivets.formatters[id].publish value, args...
i--
if(value)
Rivets.config.adapter.publish @model, @keypath, value
# Subscribes to the model for changes at the specified keypath. Bi-directional
......