module Hpricot::Container::Trav

def insert_before(nodes, ele)

before the node +ele+, a child of the current node.
Insert +nodes+, an array of HTML elements or a single element,
def insert_before(nodes, ele)
  case nodes
  when Array
    nodes.each { |n| insert_before(n, ele) }
  else
    reparent nodes
    children[children.index(ele) || 0, 0] = nodes
  end
end