Module: Taka::DOM::HTML::OptionElement

Includes:
FieldSetElement
Defined in:
lib/taka/dom/html/option_element.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from FieldSetElement

#form

Instance Attribute Details

#defaultSelectedObject

Returns the value of attribute defaultSelected.



7
8
9
# File 'lib/taka/dom/html/option_element.rb', line 7

def defaultSelected
  @defaultSelected
end

Class Method Details

.extended(option) ⇒ Object



10
11
12
# File 'lib/taka/dom/html/option_element.rb', line 10

def extended option
  option.defaultSelected = !!option['selected']
end

Instance Method Details

#indexObject



19
20
21
22
23
24
25
26
27
# File 'lib/taka/dom/html/option_element.rb', line 19

def index
  select = parent
  while select.node_name != 'select'
    select = select.parent
  end
  select.options.each_with_index { |o,i|
    return i if o == self
  }
end

#selectedObject



15
16
17
# File 'lib/taka/dom/html/option_element.rb', line 15

def selected
  !!self['selected']
end