-# rivets.js
-# version : 0.1.2
-# author : Michael Richards
-# license : MIT
+#     rivets.js
+#     version : 0.1.2
+#     author : Michael Richards
+#     license : MIT
 
+# Registers a specific binding routine between a model object and a DOM element.
+# All information for that routine is passed in when calling this function; the
+# specific element to bind to, an adapter interface for the model object, the
+# type of binding, the context object and the keypath at which to subscribe to
+# on the model object.
 registerBinding = (el, adapter, type, context, keypath) ->
   bind = bindings[type] || attributeBinding type
   bind el, adapter.read context, keypath

  hide: (el, value) ->
    el.style.display = if value then 'none' else ''

bidirectionals = ['value', 'checked', 'unchecked', 'selected', 'unselected']

rivets =
  bind: (el, adapter, contexts = {}) ->
    for node in el.getElementsByTagName '*'

          keypath = path.join '.'
          registerBinding node, adapter, type, contexts[context], keypath

# Exports rivets for both CommonJS and the browser.
if module?
  module.exports = rivets
else
