Continue when errors parsing inline JavaScript

And fix converting a document without a doctype to string