Selectors support in the state machine.

Had to remove white space stripping as there was no way to distinguish
selectors like "a.class" from "a .class".