postmodern / nokogiri-diff

Calculate the differences between two XML/HTML documents.
MIT License
131 stars 12 forks source link

Ignore differences in body in attribute order? #10

Closed sotayamashita closed 6 years ago

sotayamashita commented 6 years ago

I have tried to compare HTML tags and I got a wired behavior. Is it correct behavior?

Repro:

require 'nokogiri'
require 'nokogiri/diff'

x = Nokogiri::XML("<html><body><foo a='a' b='b'></foo><body>")
y = Nokogiri::XML("<html><body><foo b='b' a='a'></foo><body>")

puts x.tdiff_equal(y)
=> false

puts x.css('body')[0].tdiff_equal(y.css('body')[0])
=> true

ref: #5