Method: Element#initialize

Defined in:
lib/source/redshift/element.rb

#initialize(tag, attributes = {}) ⇒ Element

call-seq:

Element.new(sym, attributes = {}) -> element

Returns a new Element with the tag sym and the given attributes.

Element.new(:div, :id => 'my_div', :class => 'inserted')    #=> #<Element: DIV id="my_div" class="inserted">


38
39
40
41
42
# File 'lib/source/redshift/element.rb', line 38

def initialize(tag, attributes = {})
  `if(!tag){return nil;}`
  `this.__native__ = document.createElement(tag.__value__)`
  self.set_properties(attributes)
end