Module: Canon::PrettyPrinter::HtmlVoidElements

Defined in:
lib/canon/pretty_printer/html_void_elements.rb

Overview

The 14 HTML5 void elements — those whose start tag may stand alone (with no end tag) and which cannot have any content. Every other element with no children must be written as <tag></tag> in HTML; writing <a/> is illegal HTML and is parsed as <a> (start tag only).

Constant Summary collapse

VOID =
Set.new(%w[area base br col embed hr img input link meta param
source track wbr]).freeze

Class Method Summary collapse

Class Method Details

.void?(name) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/canon/pretty_printer/html_void_elements.rb', line 15

def self.void?(name)
  VOID.include?(name.to_s.downcase)
end