Class: Browser::DOM::Element::Input

Inherits:
Browser::DOM::Element show all
Defined in:
opal/browser/dom/element/input.rb

Constant Summary

Constants inherited from Browser::DOM::Element

Img

Constants inherited from Node

Node::ATTRIBUTE_NODE, Node::CDATA_SECTION_NODE, Node::COMMENT_NODE, Node::DOCUMENT_FRAGMENT_NODE, Node::DOCUMENT_NODE, Node::DOCUMENT_TYPE_NODE, Node::ELEMENT_NODE, Node::ENTITY_NODE, Node::ENTITY_REFERENCE_NOCE, Node::NOTATION_NODE, Node::PROCESSING_INSTRUCTION_NODE, Node::TEXT_NODE

Instance Attribute Summary collapse

Attributes inherited from Browser::DOM::Element

#attribute_nodes, #attributes, #class_name, #class_names, #editable, #height, #id, #offset, #position, #scroll, #size, #style!, #width, #window

Attributes inherited from Node

#child, #children, #document, #element_children, #first_element_child, #inner_html, #last_element_child, #name, #namespace, #next, #next_element, #node_type, #parent, #previous, #previous_element

Instance Method Summary collapse

Methods inherited from Browser::DOM::Element

#/, #=~, #[], #[]=, #add_class, #animate, #animation_queue, #at, #at_css, #at_xpath, #blur, #click, create, #css, #data, def_selector, #edit, #editable?, #fade_in, #fade_out, #fade_toggle, #focus, #focused?, #hide, #inner_dom, #inner_dom=, #inspect, native_matches?, new, #remove_attribute, #remove_class, #search, selector, #shadow, #shadow?, #show, #slide_down, #slide_toggle, #slide_up, #style, subclasses, tag_name, #toggle, #toggle_class, #visible?, #xpath

Methods included from Event::Target

#off, #on, #on!, #one, #trigger, #trigger!

Methods inherited from Node

#<<, #==, #>>, #add_child, #add_next_sibling, #add_previous_sibling, #ancestors, #append_to, #blank?, #cdata?, #comment?, #content, #content=, #document?, #elem?, #fragment?, #initialize_copy, new, #parse, #path, #prepend_to, #remove, #remove_child, #replace, #text?, #traverse

Methods included from NativeCachedWrapper

#restricted?, #set_native_reference

Instance Attribute Details

#filesArray<File> (readonly)

Returns list of files attached to this Browser::DOM::Element::Input.

Returns:


59
60
61
# File 'opal/browser/dom/element/input.rb', line 59

def files
  Native::Array.new(`#@native.files`).map { |f| File.new(f.to_n) }
end

Instance Method Details

#check!Object


33
34
35
# File 'opal/browser/dom/element/input.rb', line 33

def check!
  `#@native.checked = 'checked'`
end

#checked?Boolean

Returns:

  • (Boolean)

29
30
31
# File 'opal/browser/dom/element/input.rb', line 29

def checked?
  `#@native.checked`
end

#clearObject


53
54
55
# File 'opal/browser/dom/element/input.rb', line 53

def clear
  `#@native.value = ''`
end

#disable!Object


45
46
47
# File 'opal/browser/dom/element/input.rb', line 45

def disable!
  `#@native.disabled = 'disabled'`
end

#enable!Object


49
50
51
# File 'opal/browser/dom/element/input.rb', line 49

def enable!
  `#@native.disabled = ''`
end

#enabled?Boolean

Returns:

  • (Boolean)

41
42
43
# File 'opal/browser/dom/element/input.rb', line 41

def enabled?
  `#@native.enabled`
end

#name_Object


21
22
23
# File 'opal/browser/dom/element/input.rb', line 21

def name_
  `#@native.name`
end

#typeObject


25
26
27
# File 'opal/browser/dom/element/input.rb', line 25

def type
  `#@native.type`
end

#uncheck!Object


37
38
39
# File 'opal/browser/dom/element/input.rb', line 37

def uncheck!
  `#@native.checked = ''`
end

#valueObject


6
7
8
9
10
11
12
13
14
15
# File 'opal/browser/dom/element/input.rb', line 6

def value
  %x{
    if (#@native.value == "") {
      return nil;
    }
    else {
      return #@native.value;
    }
  }
end

#value=(value) ⇒ Object


17
18
19
# File 'opal/browser/dom/element/input.rb', line 17

def value=(value)
  `#@native.value = #{value}`
end