Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Slash at the end of the line in haml - should I clean it?

Tags:

ruby

haml

I'm wondering why in the source code of my project I sometimes see a / at the end of the line (Haml).

%meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}/

Maybe it's due to some HTML to Haml conversion, but why?

I cannot find any doc about that. Just wondering if I should clean this.

like image 424
Vadorequest Avatar asked Feb 14 '23 02:02

Vadorequest


1 Answers

It creates a void self-closing tag.

The forward slash character, when placed at the end of a tag definition, causes Haml to treat it as being an empty (or void) element. Depending on the format, the tag will be rendered either without a closing tag (:html4 or :html5), or as a self-closing tag (:xhtml).

See the HAML documentation: http://haml.info/docs/yardoc/file.REFERENCE.html#empty-void-tags-

like image 58
sevenseacat Avatar answered Feb 22 '23 22:02

sevenseacat