Faster implementation of filter.

This implementation improves performance a lot:
- Not enabling filtering detached elements flag (like jQuery does) is as faster as jQuery
- Enabling the flag is only 3 times slower instead of 50, It performs better in loops, specially decreasing time when creating ghost parents.

 Fixes issue #177 
I have used Julien's test example for measuring times.
https://github.com/manolo/testissue146/commits/master