Skip to content

Commit

Permalink
HTML-36 Don't concatenate blank on nil attribute value
Browse files Browse the repository at this point in the history
  • Loading branch information
sbsoftware committed Jun 20, 2024
1 parent 7bbe065 commit 62d90ee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion spec/instance_template/attributes_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module ToHtml::InstanceTemplate::AttributesSpec
ToHtml.instance_template do
div MyCssClass, MyOtherCssClass, {"class", "so-unique"}, more_css_classes do
span(SPECIAL_CSS_CLASSES) { "Blah" }
img SPECIAL_CSS_CLASSES, more_css_classes
img SPECIAL_CSS_CLASSES, more_css_classes, {"class", nil}
div MyStimulusController do
p({"class", "so-special"}) do
"Some content"
Expand Down
2 changes: 1 addition & 1 deletion src/attribute_hash.cr
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module ToHtml

def []=(key, value)
if attributes.has_key?(key)
attributes[key] += " #{value}"
attributes[key] += " #{value}" if value
else
attributes[key] = value.to_s
end
Expand Down

0 comments on commit 62d90ee

Please sign in to comment.