Skip to content

[bug] Node#to_xhtml does not have self-closing tags when using libxml 2.9.11 and later #2324

Closed
@haxxxton

Description

@haxxxton

What problem are you trying to solve?

We have been using nokogiri in combination with approvals files in our rspecs. We've just version bumped up to 1.11.4 and found that all our self-closing tags have changed to include closing tags. Is there a configuration option im missing, or is this the way things should be now? (is this changed in a later version is should move to more recently?)

Please show your code!
Note the <col /> to <col></col>

-<table id="invoice-items"><col width="80" /><col width="60" /><col /><col width="100" /><col width="100" /><col width="100" /><thead><tr><th class="service-date">Service date</th>
+<table id="invoice-items"><col width="80"></col><col width="60"></col><col></col><col width="100"></col><col width="100"></col><col width="100"></col><thead><tr><th class="service-date">Service date</th>

Environment

# Nokogiri (1.11.4)
    ---
    warnings: []
    nokogiri:
      version: 1.11.4
      cppflags:
      - "-I/Users/REDACTED/.rbenv/versions/2.5.9/lib/ruby/gems/2.5.0/gems/nokogiri-1.11.4-x86_64-darwin/ext/nokogiri"
      - "-I/Users/REDACTED/.rbenv/versions/2.5.9/lib/ruby/gems/2.5.0/gems/nokogiri-1.11.4-x86_64-darwin/ext/nokogiri/include"
      - "-I/Users/REDACTED/.rbenv/versions/2.5.9/lib/ruby/gems/2.5.0/gems/nokogiri-1.11.4-x86_64-darwin/ext/nokogiri/include/libxml2"
      ldflags: []
    ruby:
      version: 2.5.9
      platform: x86_64-darwin19
      gem_platform: x86_64-darwin-19
      description: ruby 2.5.9p229 (2021-04-05 revision 67939) [x86_64-darwin19]
      engine: ruby
    libxml:
      source: packaged
      precompiled: true
      patches:
      - 0001-Remove-script-macro-support.patch
      - 0002-Update-entities-to-remove-handling-of-ssi.patch
      - 0003-libxml2.la-is-in-top_builddir.patch
      - 0004-use-glibc-strlen.patch
      - 0005-avoid-isnan-isinf.patch
      - 0006-update-automake-files-for-arm64.patch
      libxml2_path: "/Users/REDACTED/.rbenv/versions/2.5.9/lib/ruby/gems/2.5.0/gems/nokogiri-1.11.4-x86_64-darwin/ext/nokogiri"
      iconv_enabled: true
      compiled: 2.9.12
      loaded: 2.9.12
    libxslt:
      source: packaged
      precompiled: true
      patches:
      - 0001-update-automake-files-for-arm64.patch
      - 0002-Fix-xml2-config-check-in-configure-script.patch
      compiled: 1.1.34
      loaded: 1.1.34
    other_libraries:
      zlib: 1.2.11
      libiconv: '1.15'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions