HTML automatically changes multiple whitespace characters into one single space.
This would lead to the following issue:
- There is no visual difference between one or two spaces, so I cannot see the difference between tests where I check if [backslash]+[space]+[space] is correctly trimmed to [backslash]+[space] and the check where I check if there is no modification of [backslash]+[space]
A solution would be to extend the function escapeInnerText with " " in both the regex and the switch
return s.replace( /[\&<> ]/g, function( s ) {
switch( s ) {
case "&": return "&";
case "<": return "<";
case ">": return ">";
case " ": return " ";
default: return s;
}
});