various fixes in utils.js

revealed by linters

- remove duplicate WrappedError definition
- regex_split doesn't actually allow string separator
- remove various unused variables
- fix some incorrect regex escaping
- add missing quotes in $('body')
- remove a `for(attr in object)` because javascript
Merge pull request #7187 from minrk/utils-js

various fixes in utils.js