Module Ronn::Utils
In: lib/ronn/utils.rb

Methods

Constants

HTML = %w[ a abbr acronym address applet area b base basefont bdo big blockquote body br button caption center cite code col colgroup dd del dfn dir div dl dt em fieldset font form frame frameset h1 h2 h3 h4 h5 h6 head hr html i iframe img input ins isindex kbd label legend li link map menu meta noframes noscript object ol optgroup option p param pre q s samp script select small span strike strong style sub sup table tbody td textarea tfoot th thead title tr tt u ul var ].to_set   All HTML 4 elements and some that are in common use.
HTML_BLOCK = %w[ blockquote body colgroup dd div dl dt fieldset form frame frameset h1 h2 h3 h4 h5 h6 hr head html iframe li noframes noscript object ol optgroup option p param pre script select style table tbody td textarea tfoot th thead title tr tt ul ].to_set   Block elements.
HTML_INLINE = HTML - HTML_BLOCK   Inline elements
HTML_EMPTY = %w[area base basefont br col hr input link meta].to_set   Elements that don‘t have a closing tag.

Public Instance methods

[Source]

    # File lib/ronn/utils.rb, line 31
31:     def block_element?(name)
32:       HTML_BLOCK.include?(name)
33:     end

[Source]

    # File lib/ronn/utils.rb, line 47
47:     def child_of?(node, tag)
48:       while node
49:         return true if node.name && node.name.downcase == tag
50:         node = node.parent
51:       end
52:       false
53:     end

[Source]

    # File lib/ronn/utils.rb, line 39
39:     def empty_element?(name)
40:       HTML_EMPTY.include?(name)
41:     end

[Source]

    # File lib/ronn/utils.rb, line 43
43:     def html_element?(name)
44:       HTML.include?(name)
45:     end

[Source]

    # File lib/ronn/utils.rb, line 35
35:     def inline_element?(name)
36:       HTML_INLINE.include?(name)
37:     end

[Validate]