Better handle class names and the empty string

This actually handles two distinct problems:

 1. Elements with no class attribute at all would have a classNames Set
    that contained a single entry (the empty string); see #317

 2. Elements whose class attribute contained leading or trailing
    whitespace would have an extra classNames Set entry for the empty
    string, and a className with either a leading or trailing space