   renderComponent: ->
     component = @
 
+    # If mixins have not yet been created.
+    component.createMixins()
+
     componentTemplate = component.template()
     if _.isString componentTemplate
       templateBase = Template[componentTemplate]

  originalDOMRangeAttach.apply @, arguments

class BlazeComponent extends BaseComponent
  # This class method more or less just creates an instance of a component and calls its renderComponent
  # method. But because we want to allow passing arguments to the component in templates, we have some
  # complicated code around to extract and pass those arguments.


  insertDOMElement: (parent, node, before) ->
    parent.insertBefore node, before
    return

  moveDOMElement: (parent, node, before) ->
    parent.insertBefore node, before
    return

  removeDOMElement: (node) ->
    node.parentNode.removeChild node
    return

  events: ->
    []
