alternative implementation of the html5lib attribute scrubbing algorithm
lifted nearly verbatim from html5lib
[Validate]