[2.2] [CssSelector] fixes and enhancements

fixes nth-child & nth-last-child
fixes :not()
fixes issue #3547
fixes attribute selector matching
added new tests

Most changes ported from the Nokogiri gem.