Class: Celerity::Button
- Celerity::Element
- Celerity::InputElement
- Celerity::Button
Input: Button
Class representing button elements
Constants
- ATTRIBUTES
- BASE_ATTRIBUTES | [:type, :disabled, :tabindex, :accesskey, :onfocus, :onblur] | [:src, :usemap, :ismap]
- DEFAULT_HOW
- :value
- TAGS
- [ Identifier.new('button'), Identifier.new('input', :type => %w[submit reset image button]) ]
Constants Inherited from Celerity::Element
BASE_ATTRIBUTES, CELLHALIGN_ATTRIBUTES, CELLVALIGN_ATTRIBUTES, HTML_401_TRANSITIONAL, TO_S_SIZE
Constructor Summary
This class inherits a constructor from Celerity::Element.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Celerity::Element
Dynamically get element attributes.
[View source]
235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/celerity/element.rb', line 235 def method_missing(meth, *args, &blk) assert_exists meth = selector_to_attribute(meth) if self.class::ATTRIBUTES.include?(meth) || (self.class == Element && @object.hasAttribute(meth.to_s)) return @object.getAttribute(meth.to_s) end Log.warn "Element\#method_missing calling super with #{meth.inspect}" super end |
Public Visibility
Public Instance Method Summary
#locate |
---|
Public Instance Methods Inherited from Celerity::InputElement
Public Instance Methods Inherited from Celerity::Element
assert_exists, attribute_string, attribute_value, exists?, fire_event, focus, methods, object, parent, respond_to?, text, to_s, to_xml, visible?, xpath
Public Instance Method Details
locate
public
locate
[View source]
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/celerity/elements/button.rb', line 22 def locate # We want the :value attribute to point to the inner HTML for <button> elements, # and to the value attribute for <input type="button"> elements. if (val = @conditions[:value]) = Identifier.new('button') .text = val input_ident = Identifier.new('input', :type => %w[submit reset image button], :value => [val]) locator = ElementLocator.new(@container, self.class) locator.idents = [, input_ident] conditions = @conditions.dup conditions.delete(:value) @object = locator.find_by_conditions(conditions) else super end end |