def create_element(target, type, parent, options = {})
      # Create element
      element = `document.createElement(#{type})`

      # Add element to DOM
      if options[:prepend]
        `#{parent.element}.insertBefore(#{element}, #{options[:prepend].element})`
      else
        `#{parent.element}.appendChild(#{element})`
      end

      if !@compositor
        # Add ruby class to the node
        `#{element}.classList.add(#{dasherize(target.class.name)})`

        # Add ruby superclass to the node to allow for more generic styling
        if target.class.superclass != BaseElement
          `#{element}.classList.add(#{dasherize(target.class.superclass.name)})`
        end
      else
        # Add classes defined by compositor
        composite_classes(target, element, target.class.superclass != BaseElement)
      end

      # Set ruby object_id as default element id
      if !options.has_key?(:id)
        `#{element}.id = '_' + #{target.object_id}`
      end

      # Set attributes
      options.each do |name, value|
        case name
        when :prepend
          nil
        when :content
          `#{element}.appendChild(document.createTextNode(#{value}))`
        else
          `#{element}.setAttribute(#{name}, #{value})`
        end
      end

      element
    end
def create_element(target, type, parent, options = {})
      # Create element
      element = `document.createElement(#{type})`

      # Add element to DOM
      if options[:prepend]
        `#{parent.element}.insertBefore(#{element}, #{options[:prepend].element})`
      else
        `#{parent.element}.appendChild(#{element})`
      end

      if !@compositor
        # Add ruby class to the node
        `#{element}.classList.add(#{dasherize(target.class.name)})`

        # Add ruby superclass to the node to allow for more generic styling
        if target.class.superclass != BaseElement
          `#{element}.classList.add(#{dasherize(target.class.superclass.name)})`
        end
      else
        # Add classes defined by compositor
        composite_classes(target, element, target.class.superclass != BaseElement)
      end

      # Set ruby object_id as default element id
      if !options.has_key?(:id)
        `#{element}.id = '_' + #{target.object_id}`
      end

      # Set attributes
      options.each do |name, value|
        case name
        when :prepend
          nil
        when :content
          `#{element}.appendChild(document.createTextNode(#{value}))`
        else
          `#{element}.setAttribute(#{name}, #{value})`
        end
      end

      element
    end
Creates the factory. Do not create a factory directly, instead
 call the 'factory' method that is available in all Ferro classes

 @param [Object] target The Ruby class instance
 @param [Compositor] compositor A style-compositor object or nil
 Create a DOM element.

 @param [Object] target The Ruby class instance
 @param [String] type Type op DOM element to create
 @param [String] parent The Ruby parent element
 @param [Hash] options Options to pass to the element.
   See FerroElementary::add_child
 @return [String] the DOM element