FIX: Normalizer wasn't working with attributes without values

This commit is contained in:
Robin Ward 2017-11-02 14:11:20 -04:00
parent 5a55ce65f3
commit 64cb8a3ce3
2 changed files with 9 additions and 3 deletions

View File

@ -74,9 +74,11 @@ class HtmlNormalize
attrs.each do |a|
buffer << " "
buffer << a.name
buffer << "='"
buffer << a.value
buffer << "'"
if a.value
buffer << "='"
buffer << a.value
buffer << "'"
end
end
end

View File

@ -7,6 +7,10 @@ describe HtmlNormalize do
HtmlNormalize.normalize(html)
end
it "handles attributes without values" do
expect(n "<img alt>").to eq("<img alt>")
end
it "handles self closing tags" do
source = <<-HTML