             oj.option op
           return
         return
-
-  methods:
-    make: -> oj.select change: => @viewChange(); return
 
 # oj.Table
 # ------------------------------------------------------------------------------

# ==============================================================================
# A unified templating framework for the people. Thirsty people.


# oj function
# ------------------------------------------------------------------------------
# Convert ojml to dom
oj = module.exports = ->
  _.argumentsPush()
  ojml = oj.tag 'oj', arguments...
  _.argumentsPop()


# oj.View
# ------------------------------------------------------------------------------

oj.View = oj.type 'View',

  # Views are special objects map properties together. This is a union of arguments
  # With the remaining arguments becoming a list

  constructor: (args = {}) ->
    # console.log "View.constructor: ", JSON.stringify arguments

    throw new Error("oj.#{@typeName}: constructor did not set this.el") unless oj.isDOM @el

    # Views act like tag methods and support the div -> syntax.
    # Append this to parent
    _.argumentsAppend @

    # Generate id if missing
    args.id ?= oj.id()

    # Add typeName class
    @$el.addClass @typeName

    # Views automatically set all options to their properties
    # arguments directly to properties
    @set args

    # Remove options that were set
    args = _.omit args, @properties...

    # Views pass through remaining options to be attributes on the root element
    # This can include jquery events and interpreted arguments
    @addAttributes args

  properties:
    # Get element
    el: null

    # Get jquery-enabled element (readonly)
    $el:
      get: -> $(@el)

    # Get all attributes (readonly)
    attributes:
      get: ->
        out = {}
        $.each @el.attributes, (index, attr) -> out[ attr.name ] = attr.value;
        out

  methods:

    # Mirror backbone find sub elements via jquery selector
    $: -> @$el.find.apply @, arguments

    # Add a single attribute
    addAttribute: (name,value) ->
      attr = {}
      attr[name] = value
