def previous_element(name = nil)
      if siblings = parent.children
        found = nil
        siblings.each do |node|
          return found if node.equal?(self)
          found = node if node.tag? && (name.nil? || node.name == name)
        end
      end
      nil
    end
def previous_element(name = nil)
      if siblings = parent.children
        found = nil
        siblings.each do |node|
          return found if node.equal?(self)
          found = node if node.tag? && (name.nil? || node.name == name)
        end
      end
      nil
    end
Return the previous element before this one. Skips sibling text
 nodes.

 Using the +name+ argument, returns the previous element with
 that name, skipping other sibling elements.