diff --git a/src/mechanize/form.cr b/src/mechanize/form.cr index a868ec1..f3a8606 100644 --- a/src/mechanize/form.cr +++ b/src/mechanize/form.cr @@ -8,7 +8,7 @@ require "./form/button" require "./form/select_list" require "./utils/element_matcher" -# THis class represents the form tag of html. +# This class represents the form tag of html. class Mechanize::Form include Mechanize::ElementMatcher @@ -68,7 +68,7 @@ class Mechanize::Form elements_with "checkbox", "checkboxes" elements_with "button" - # Returns all fields of type Textarea + # Returns all fields of def textareas fields.select { |f| f.class == FormContent::Textarea }.map &.as(FormContent::Textarea) end diff --git a/src/mechanize/form/field.cr b/src/mechanize/form/field.cr index 4eb7c23..27f800e 100644 --- a/src/mechanize/form/field.cr +++ b/src/mechanize/form/field.cr @@ -1,7 +1,14 @@ +# This class represents elements in the form. class Mechanize::FormContent::Field + + # returns field's 'value' attribute property value : String? + # returns field's 'name' attribute getter name : String + # returns field's 'type' attribute getter type : String + # returns field's 'value' attribute. + # value property is changeable, but this property stores raw value. getter raw_value : String? getter node : Node | Lexbor::Node @@ -17,12 +24,12 @@ class Mechanize::FormContent::Field [@name, @value || ""] end - # returns DOM 'id' value + # returns field's 'id' value def dom_id node.fetch("id", "") end - # returns DOM 'class' value + # returns field's 'class' value def dom_class node.fetch("class", "") end diff --git a/src/mechanize/form/hidden.cr b/src/mechanize/form/hidden.cr index ca409dd..59557f6 100644 --- a/src/mechanize/form/hidden.cr +++ b/src/mechanize/form/hidden.cr @@ -1,2 +1,3 @@ +# This class represents class Mechanize::FormContent::Hidden < Mechanize::FormContent::Field end diff --git a/src/mechanize/form/text.cr b/src/mechanize/form/text.cr index 894dafd..e39fd47 100644 --- a/src/mechanize/form/text.cr +++ b/src/mechanize/form/text.cr @@ -1,2 +1,3 @@ +# This class represents class Mechanize::FormContent::Text < Mechanize::FormContent::Field end diff --git a/src/mechanize/form/textarea.cr b/src/mechanize/form/textarea.cr index b7c825a..39a4094 100644 --- a/src/mechanize/form/textarea.cr +++ b/src/mechanize/form/textarea.cr @@ -1,2 +1,3 @@ +# This class represents class Mechanize::FormContent::Textarea < Mechanize::FormContent::Field end