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.

有帮助吗?

解决方案

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-

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top