Use more robust string -> fragment conversion

Using the wrapper technique from jQuery so that
utils.toFragment() can deal with table elements
and SVG elements (with proper namespace)