From f3c0af64605fa9d243fc47cf0e4ef7c3c67877d0 Mon Sep 17 00:00:00 2001 From: Anton Maminov Date: Wed, 18 Aug 2021 17:50:03 +0300 Subject: [PATCH] fix parse input without type attribute --- spec/form_spec.cr | 2 +- src/mechanize/form.cr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/form_spec.cr b/spec/form_spec.cr index fb03481..f8c38f6 100644 --- a/spec/form_spec.cr +++ b/spec/form_spec.cr @@ -8,7 +8,7 @@ WebMock.stub(:get, "example.com/check_form").to_return(body: <<-BODY
- + diff --git a/src/mechanize/form.cr b/src/mechanize/form.cr index 49f3270..1edb015 100644 --- a/src/mechanize/form.cr +++ b/src/mechanize/form.cr @@ -65,7 +65,7 @@ class MechanizeCr::Form private def parse @node.css("input").not_nil!.each do |html_node| html_node = html_node.as(Lexbor::Node) - type = (html_node["type"] || "text").downcase + type = (html_node["type"]? || "text").downcase case type when "checkbox" checkboxes << FormContent::CheckBox.new(html_node, self)