Module: Loofah::Elements

Defined in:
lib/loofah/elements.rb

Constant Summary collapse

STRICT_BLOCK_LEVEL_HTML4 =
Set.new([
  "address",
  "blockquote",
  "center",
  "dir",
  "div",
  "dl",
  "fieldset",
  "form",
  "h1",
  "h2",
  "h3",
  "h4",
  "h5",
  "h6",
  "hr",
  "isindex",
  "menu",
  "noframes",
  "noscript",
  "ol",
  "p",
  "pre",
  "table",
  "ul",
])
STRICT_BLOCK_LEVEL_HTML5 =
Set.new([
  "address",
  "article",
  "aside",
  "blockquote",
  "canvas",
  "dd",
  "div",
  "dl",
  "dt",
  "fieldset",
  "figcaption",
  "figure",
  "footer",
  "form",
  "h1",
  "h2",
  "h3",
  "h4",
  "h5",
  "h6",
  "header",
  "hgroup",
  "hr",
  "li",
  "main",
  "nav",
  "noscript",
  "ol",
  "output",
  "p",
  "pre",
  "section",
  "table",
  "tfoot",
  "ul",
  "video",
])
LOOSE_BLOCK_LEVEL =

The following elements may also be considered block-level elements since they may contain block-level elements

Set.new([
  "dd",
  "dt",
  "frameset",
  "li",
  "tbody",
  "td",
  "tfoot",
  "th",
  "thead",
  "tr",
])
INLINE_LINE_BREAK =

Elements that aren’t block but should generate a newline in #to_text

Set.new(["br"])
STRICT_BLOCK_LEVEL =
STRICT_BLOCK_LEVEL_HTML4 + STRICT_BLOCK_LEVEL_HTML5
BLOCK_LEVEL =
STRICT_BLOCK_LEVEL + LOOSE_BLOCK_LEVEL
LINEBREAKERS =
BLOCK_LEVEL + INLINE_LINE_BREAK