substack/html-select — pull request #7 by anandthakker (2014-08-06 14:47:25+00:00)
Title: Selfclosing tag bug

Fixes #6 and adds four tests for correct parsing of self-closing tags.

There were two problems:
1. Parsing of tag name was scanning from the start of the tag until hitting whitespace or '>'; this meant that it included the trailing slashes in the case of self-closing tags that had no attributes.
2. Similarly, parsing of attributes used regex that allowed any non-whitespace and non-'=' character as an attribute name.

Fixed both by including '/' in the appropriate regex.