def root(element, element_id=nil, &block)
      if @view
        raise ContextConflictError.new("Already created the root view")
      end
      unless @assign_root
        raise InvalidRootError.new("You should only create a 'root' view from inside the 'layout' method (use 'create' elsewhere)")
      end
      @assign_root = false

      # this method can be called with just a symbol, to assign the root element_id
      if element.is_a?(Symbol)
        element_id = element
        # See note below about why we don't need to `apply(:default_root)`
        element = preset_root || default_root
      elsif preset_root && preset_root != element
        # You're trying to make two roots, one at initialization
        # and one in your layout itself.
        raise ContextConflictError.new("Already created the root view")
      end

      @view = initialize_element(element, element_id)

      if block
        if @context
          raise ContextConflictError.new("Already in a context")
        end
      end

      style_and_context(@view, element_id, &block)

      return @view
    end
def root(element, element_id=nil, &block)
      if @view
        raise ContextConflictError.new("Already created the root view")
      end
      unless @assign_root
        raise InvalidRootError.new("You should only create a 'root' view from inside the 'layout' method (use 'create' elsewhere)")
      end
      @assign_root = false

      # this method can be called with just a symbol, to assign the root element_id
      if element.is_a?(Symbol)
        element_id = element
        # See note below about why we don't need to `apply(:default_root)`
        element = preset_root || default_root
      elsif preset_root && preset_root != element
        # You're trying to make two roots, one at initialization
        # and one in your layout itself.
        raise ContextConflictError.new("Already created the root view")
      end

      @view = initialize_element(element, element_id)

      if block
        if @context
          raise ContextConflictError.new("Already in a context")
        end
      end

      style_and_context(@view, element_id, &block)

      return @view
    end
just in case
 Assign a view to act as the 'root' view for this layout.  This method can
 only be called once, and must be called before `add` is called for the
 first time (otherwise `add` will create a default root view).  This method
 must be called from inside `layout`, otherwise you should just use
 `create`.

 You can also call this method with just an element_id, and the default
 root view will be created.