Enhance class matching to accept space-separated list or array

Previously class matching was happening by simple equality checking. This update allows `options.class` to be (or return) either a space-separated string or an array of strings. Also adds a test for both of these.