Class: HtmlCom::InputElement

Inherits:
Element
  • Object
show all
Defined in:
lib/htmlcom.rb

Direct Known Subclasses

Dropdown, Textarea

Instance Method Summary collapse

Methods inherited from Element

#build, #html_element, #to_doc, #to_html

Constructor Details

#initialize(rawobj) ⇒ InputElement

Returns a new instance of InputElement.



370
371
372
373
374
375
376
377
378
379
380
381
382
# File 'lib/htmlcom.rb', line 370

def initialize(rawobj)

  if @label then

    obj = [{label: @label}, rawobj]
    super({@tag.to_sym => obj})
    @doc.root.element(@tag + '/label').attributes[:for] = @id

  else
    super({@tag.to_sym => rawobj})
  end

end