reverted last change and added overall better handling of HTML attribute escaping