File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ class SaveOptions
3434 DEFAULT_HTML = FORMAT | NO_DECLARATION | NO_EMPTY_TAGS | AS_HTML
3535 end
3636 # the default for XHTML document
37- DEFAULT_XHTML = FORMAT | NO_DECLARATION | NO_EMPTY_TAGS | AS_XHTML
37+ DEFAULT_XHTML = FORMAT | NO_DECLARATION | AS_XHTML
3838
3939 # Integer representation of the SaveOptions
4040 attr_reader :options
Original file line number Diff line number Diff line change @@ -370,6 +370,15 @@ def test_to_xhtml
370370 assert_match ( "UTF-8" , html . to_xhtml ( encoding : "UTF-8" ) )
371371 end
372372
373+ def test_to_xhtml_self_closing_tags
374+ # https://github.com/sparklemotion/nokogiri/issues/2324
375+ html = "<html><body><br><table><colgroup><col>"
376+ doc = Nokogiri ::HTML ::Document . parse ( html )
377+ xhtml = doc . to_xhtml
378+ assert_match ( %r(<br ?/>) , xhtml )
379+ assert_match ( %r(<col ?/>) , xhtml )
380+ end
381+
373382 def test_no_xml_header
374383 html = Nokogiri ::HTML ( <<~EOHTML )
375384 < html >
You can’t perform that action at this time.
0 commit comments