Copy script tag contents when adding to document

Inline scripts were not being added to the document correctly, all their
content were missing.
Merge pull request #1464