better handling of JavaScript embedded in HTML