Method: Fdlint::Parser::HTML::Element#initialize

Defined in:
lib/fdlint/parser/html/struct.rb

#initialize(tag, props = [], children = [], close_type = :after, ending = nil) ⇒ Element

Returns a new instance of Element.



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/fdlint/parser/html/struct.rb', line 43

def initialize(tag, props=[], children=[], close_type=:after, ending=nil)

  @tag, @close_type, @ending = tag, close_type, ending
  @props  = to_props( props )
  @scopes = []

  if tag.respond_to?( :position ) and tag.position
    @position = @tag.position.dup
  end

  @children = (Array.[](children).flatten || []).tap do |children|
    children.each do |child|
      child.parent = self
    end
  end
end