Coding style fix.
Fixes a locator generation bug and moves polyfills to a separate file.

This bug happens when the `class` HTML property contains more than one
consecutive spaces or a trailing space.