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
32 def block_element?(name)
33   HTML_BLOCK.include?(name)
34 end
child_of?(node, tag) click to toggle source
   # File lib/ronn/utils.rb
48 def child_of?(node, tag)
49   while node
50     return true if node.name && node.name.downcase == tag
51     return false if node.document?
52     node = node.parent
53   end
54   false
55 end
empty_element?(name) click to toggle source
   # File lib/ronn/utils.rb
40 def empty_element?(name)
41   HTML_EMPTY.include?(name)
42 end
html_element?(name) click to toggle source
   # File lib/ronn/utils.rb
44 def html_element?(name)
45   HTML.include?(name)
46 end
inline_element?(name) click to toggle source
   # File lib/ronn/utils.rb
36 def inline_element?(name)
37   HTML_INLINE.include?(name)
38 end