Generic solution for the innerHTML IE issue

Stop using innerHTML to remove the contents of an element.
IE will modify the children instead of just removing them. In some cases
the children will be corrupted and we're not able to add them anymore
to the document.
Test case: http://jsfiddle.net/89X6F/
Merge pull request #1444 from aadsm/fix-substitution-ie

Generic solution for the innerHTML IE issue