refactor form#initialize
This commit is contained in:
parent
f09d0715a3
commit
1e7ebdd354
@ -9,18 +9,17 @@ class MechanizeCr::Form
|
|||||||
property action : String
|
property action : String
|
||||||
|
|
||||||
def initialize(node : Node | Myhtml::Node)
|
def initialize(node : Node | Myhtml::Node)
|
||||||
@enctype = node["enctype"]? ? node["enctype"] : "application/x-www-form-urlencoded"
|
@enctype = node.fetch("enctype", "application/x-www-form-urlencoded")
|
||||||
@node = node
|
@node = node
|
||||||
@fields = Array(MechanizeCr::FormContent::Field).new
|
@fields = Array(MechanizeCr::FormContent::Field).new
|
||||||
@checkboxes = Array(MechanizeCr::FormContent::CheckBox).new
|
@checkboxes = Array(MechanizeCr::FormContent::CheckBox).new
|
||||||
#@action = Mechanize::Util.html_unescape(node['action'])
|
@action = node.fetch("action", "")
|
||||||
@action = node["action"]
|
@method = node.fetch("method", "GET").upcase
|
||||||
@method = (node["method"] || "GET").upcase
|
|
||||||
#@name = node['name']
|
#@name = node['name']
|
||||||
#@clicked_buttons = []
|
#@clicked_buttons = []
|
||||||
#@page = page
|
#@page = page
|
||||||
#@mech = mech
|
#@mech = mech
|
||||||
#
|
|
||||||
#@encoding = node['accept-charset'] || (page && page.encoding) || nil
|
#@encoding = node['accept-charset'] || (page && page.encoding) || nil
|
||||||
#@ignore_encoding_error = false
|
#@ignore_encoding_error = false
|
||||||
parse
|
parse
|
||||||
|
Loading…
Reference in New Issue
Block a user