tj / php-selector

PHP DOM parser / queries with CSS selectors
300 stars 117 forks source link

incorrect selector to xpath translation #14

Open bkdotcom opened 9 years ago

bkdotcom commented 9 years ago

'.classa > .classb'

should be: 'descendant-or-self::*[contains(concat(" ",@class," ")," classa ")]/*[contains(concat(" ",@class," ")," classb ")]' edit: corrected on 2015-08-26

changing $selector = str_replace(']/*', ']', $selector); to $selector = str_replace(']/*[position', '][position', $selector); fixes the issue and passes regression testing

bkdotcom commented 9 years ago

my bad, should be 'descendant-or-self::*[contains(concat(" ",@class," ")," classa ")]/*[contains(concat(" ",@class," ")," classb ")]'