module Hpricot::Container::Trav

def each_hyperlink_attribute

def each_hyperlink_attribute
  traverse_element(
      '{http://www.w3.org/1999/xhtml}a',
      '{http://www.w3.org/1999/xhtml}area',
      '{http://www.w3.org/1999/xhtml}link',
      '{http://www.w3.org/1999/xhtml}img',
      '{http://www.w3.org/1999/xhtml}object',
      '{http://www.w3.org/1999/xhtml}q',
      '{http://www.w3.org/1999/xhtml}blockquote',
      '{http://www.w3.org/1999/xhtml}ins',
      '{http://www.w3.org/1999/xhtml}del',
      '{http://www.w3.org/1999/xhtml}form',
      '{http://www.w3.org/1999/xhtml}input',
      '{http://www.w3.org/1999/xhtml}head',
      '{http://www.w3.org/1999/xhtml}base',
      '{http://www.w3.org/1999/xhtml}script') {|elem|
    case elem.name
    when %r{\{http://www.w3.org/1999/xhtml\}(?:base|a|area|link)\z}i
      attrs = ['href']
    when %r{\{http://www.w3.org/1999/xhtml\}(?:img)\z}i
      attrs = ['src', 'longdesc', 'usemap']
    when %r{\{http://www.w3.org/1999/xhtml\}(?:object)\z}i
      attrs = ['classid', 'codebase', 'data', 'usemap']
    when %r{\{http://www.w3.org/1999/xhtml\}(?:q|blockquote|ins|del)\z}i
      attrs = ['cite']
    when %r{\{http://www.w3.org/1999/xhtml\}(?:form)\z}i
      attrs = ['action']
    when %r{\{http://www.w3.org/1999/xhtml\}(?:input)\z}i
      attrs = ['src', 'usemap']
    when %r{\{http://www.w3.org/1999/xhtml\}(?:head)\z}i
      attrs = ['profile']
    when %r{\{http://www.w3.org/1999/xhtml\}(?:script)\z}i
      attrs = ['src', 'for']
    end
    attrs.each {|attr|
      if hyperlink = elem.get_attribute(attr)
        yield elem, attr, hyperlink
      end
    }
  }
end