Bug 837748 - Refined the escapeHTML function and added unit testing