File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -345,8 +345,9 @@ def to_html(*args)
345345 args . insert ( 0 , options )
346346 end
347347 if empty?
348- encoding = ( args . first . is_a? ( Hash ) ? args . first [ :encoding ] : nil ) || document . encoding
349- "" . encode ( encoding )
348+ encoding = ( args . first . is_a? ( Hash ) ? args . first [ :encoding ] : nil )
349+ encoding ||= document . encoding
350+ encoding . nil? ? "" : "" . encode ( encoding )
350351 else
351352 map { |x | x . to_html ( *args ) } . join
352353 end
Original file line number Diff line number Diff line change @@ -961,6 +961,12 @@ def awesome!; end
961961 assert_equal ( doc2 , node_set [ 1 ] . document )
962962 end
963963 end
964+
965+ describe "empty sets" do
966+ it "#to_html returns an empty string" do
967+ assert_equal ( "" , NodeSet . new ( xml , [ ] ) . to_html )
968+ end
969+ end
964970 end
965971 end
966972 end
You can’t perform that action at this time.
0 commit comments