tenderlove/nokogiri — Issue #578: Space lost between sub and sup tags
Author: rbreu
Created: 2011-12-02 11:41:11+00:00
State: open

(Using Nokogiri 1.5.0)

For almost all inline tags, Nokogiri preserves space between subsequent tags, as I'd expect it to:

irb(main):004:0> Nokogiri::HTML.fragment("<em>a</em> <em>b</em>").to_s
=> "<em>a</em> <em>b</em>"

However, between sup and sub tags, the space gets lost:

irb(main):002:0> Nokogiri::HTML.fragment("<sup>a</sup> <sup>b</sup>").to_s
=> "<sup>a</sup><sup>b</sup>"

irb(main):003:0> Nokogiri::HTML.fragment("<sub>a</sub> <sub>b</sub>").to_s
=> "<sub>a</sub><sub>b</sub>"

Since it makes a difference when displayed in the browser whether the space is there or not, this looks like a bug to me?