Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/nokogiri/html4/sax/push_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class PushParser
# operating
attr_accessor :document

def initialize(doc = HTML4::SAX::Document.new, file_name = nil, encoding = "UTF-8")
def initialize(doc = HTML4::SAX::Document.new, file_name_ = nil, encoding_ = "UTF-8", file_name: file_name_, encoding: encoding_)
@document = doc
@encoding = encoding
@sax_parser = HTML4::SAX::Parser.new(doc, @encoding)
Expand Down
13 changes: 13 additions & 0 deletions test/html4/sax/test_push_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,17 @@
it :test_default_options do
assert_equal(0, parser.options)
end

it :test_keyword_arguments do
parser = Nokogiri::HTML4::SAX::PushParser.new(Nokogiri::SAX::TestCase::Doc.new, encoding: "UTF-8")

parser << (<<~HTML)
<p id="asdfasdf">
<!-- This is a comment -->
Paragraph 1
</p>
HTML
parser.finish
assert_equal([" This is a comment "], parser.document.comments)
end
end