lib/ronn/utils.rb in ronn-ng-0.7.4 vs lib/ronn/utils.rb in ronn-ng-0.8.0.SNAPSHOT
- old
+ new
@@ -1,19 +1,20 @@
require 'set'
require 'cgi'
module Ronn
+ # Miscellaneous utilities.
module Utils
-
# All HTML 4 elements and some that are in common use.
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
+ 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
# Block elements.
HTML_BLOCK = %w[
blockquote body colgroup dd div dl dt fieldset form frame frameset
@@ -45,9 +46,10 @@
end
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
end