jslint: remove whitespaces using simple regex

Replacing obsolete for loop with a simple regex to remove whitespaces, if a line contains only whitespace.
updated regex to catch spaces and tabs only

seems to be cleaner, also other "weird whitespace characters" in an isolated line will be flagged as an error by jslint
Merge pull request #8674 from MartinMa/master

jslint: remove whitespaces using simple regex