Skip to content

Commit dbc6110

Browse files
committed
Merge pull request #31 from strivedi183/28_fix_br_tag
Fix issue 28 by self closing the br tag
2 parents 5d948e8 + e0cb8c7 commit dbc6110

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/arbre/html/tag.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def indent(open_tag, child_content, close_tag)
130130
end
131131

132132
def self_closing_tag?
133-
%w|meta link|.include?(tag_name)
133+
%w|br link meta|.include?(tag_name)
134134
end
135135

136136
def no_child?

spec/arbre/integration/html_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,12 @@
187187
}.to_s).to eq("<link rel=\"stylesheet\"/>\n")
188188
end
189189

190+
it "should self-close br tags" do
191+
expect(arbre {
192+
br
193+
}.to_s).to eq("<br/>\n")
194+
end
195+
190196
end
191197

192198
describe "html safe" do

0 commit comments

Comments
 (0)