fix select selection bug for chrome starting with 38

This should address #1329.

Since it's discussed in the issue, I didn't feel to bad about sticking the require path setup in here to fix support for case-sensitive filesystems too.