fixed a bug with PrimeFaces (tried to insert after JavaScript nodes,
which aren't really part of the DOM)