 # differences while avoiding it being overwritten.
 class Rivets.TextBinding extends Rivets.Binding
   # Initializes a text binding for the specified view and text node.
-  constructor: (@view, @el, @type, @key, @keypath, @options = {}) ->
+  constructor: (@view, @el, @type, @keypath, @options = {}) ->
+    interfaces = (k for k, v of @view.adapters)
+    tokens = Rivets.KeypathParser.parse(@keypath, interfaces, '.')
     @formatters = @options.formatters || []
-    @model = if @key then @view.models[@key] else @view.models
+    @setModel()
 
   # A standard routine binder used for text node bindings.
   binder:

      if @view.formatters[id]?.publish
        value = @view.formatters[id].publish value, args...

    @view.adapters['.'].publish @model, @keypath, value

  # Subscribes to the model for changes at the specified keypath. Bi-directional
  # routines will also listen for changes on the element to propagate them back
  # to the model.
  bind: =>
    @binder.bind?.call @, @el
    @view.adapters['.'].subscribe @model, @keypath, @sync
    @sync() if @view.config.preloadData

    if @options.dependencies?.length


  # Syncs up the view binding with the model.
  sync: =>
    @set @view.adapters[@key.interface].read @model, @key.path

  # Publishes the value currently set on the input element back to the model.
  publish: =>
