selection.insert() now accepts before argument as function

A minor change, but one I needed for full control of the node order inside the DOM.