HTML writer:  Refactored adding attributes to html element.