module Ronn::Utils

Miscellaneous utilities.

Constants

HTML

All HTML 4 elements and some that are in common use.

HTML_BLOCK

Block elements.

HTML_EMPTY

Elements that don't have a closing tag.

HTML_INLINE

Inline elements

Public Instance Methods

block_element?(name) click to toggle source
# File lib/ronn/utils.rb, line 32
def block_element?(name)
  HTML_BLOCK.include?(name)
end
child_of?(node, tag) click to toggle source
# File lib/ronn/utils.rb, line 48
def child_of?(node, tag)
  while node
    return true if node.name && node.name.downcase == tag
    return false if node.document?
    node = node.parent
  end
  false
end
empty_element?(name) click to toggle source
# File lib/ronn/utils.rb, line 40
def empty_element?(name)
  HTML_EMPTY.include?(name)
end
html_element?(name) click to toggle source
# File lib/ronn/utils.rb, line 44
def html_element?(name)
  HTML.include?(name)
end
inline_element?(name) click to toggle source
# File lib/ronn/utils.rb, line 36
def inline_element?(name)
  HTML_INLINE.include?(name)
end