Fix for #1304

I believe this fix addresses the problem outline in #1304.  Loop was
matching against nodes incorrectly in the case of more than 1 submit.
Tests for #1304

Wrote two tests (select by text and select by CSS) for #1304
Fixed typos
Merge pull request #1305 from fdjohnston/2.0

Fix for #1304