Fix issue with invalid document when script tag is whitelisted
Merge pull request #388 from amferraz/master

Fix issue with invalid document when script tag is whitelisted