@@ -102,18 +102,20 @@ public function getCssToXPathTestData()
102102 array ('e[foo^="bar"] ' , "e[@foo and starts-with(@foo, 'bar')] " ),
103103 array ('e[foo$="bar"] ' , "e[@foo and substring(@foo, string-length(@foo)-2) = 'bar'] " ),
104104 array ('e[foo*="bar"] ' , "e[@foo and contains(@foo, 'bar')] " ),
105+ array ('e[foo!="bar"] ' , "e[not(@foo) or @foo != 'bar'] " ),
106+ array ('e[foo!="bar"][foo!="baz"] ' , "e[(not(@foo) or @foo != 'bar') and (not(@foo) or @foo != 'baz')] " ),
105107 array ('e[hreflang|="en"] ' , "e[@hreflang and (@hreflang = 'en' or starts-with(@hreflang, 'en-'))] " ),
106- array ('e:nth-child(1) ' , "*/*[name() = 'e' and (position() = 1)] " ),
107- array ('e:nth-last-child(1) ' , "*/*[name() = 'e' and (position() = last() - 0)] " ),
108- array ('e:nth-last-child(2n+2) ' , "*/*[name() = 'e' and (last() - position() - 1 >= 0 and (last() - position() - 1) mod 2 = 0)] " ),
108+ array ('e:nth-child(1) ' , "*/*[( name() = 'e') and (position() = 1)] " ),
109+ array ('e:nth-last-child(1) ' , "*/*[( name() = 'e') and (position() = last() - 0)] " ),
110+ array ('e:nth-last-child(2n+2) ' , "*/*[( name() = 'e') and (last() - position() - 1 >= 0 and (last() - position() - 1) mod 2 = 0)] " ),
109111 array ('e:nth-of-type(1) ' , '*/e[position() = 1] ' ),
110112 array ('e:nth-last-of-type(1) ' , '*/e[position() = last() - 0] ' ),
111113 array ('div e:nth-last-of-type(1) .aclass ' , "div/descendant-or-self::*/e[position() = last() - 0]/descendant-or-self::*/*[@class and contains(concat(' ', normalize-space(@class), ' '), ' aclass ')] " ),
112- array ('e:first-child ' , "*/*[name() = 'e' and (position() = 1)] " ),
113- array ('e:last-child ' , "*/*[name() = 'e' and (position() = last())] " ),
114+ array ('e:first-child ' , "*/*[( name() = 'e') and (position() = 1)] " ),
115+ array ('e:last-child ' , "*/*[( name() = 'e') and (position() = last())] " ),
114116 array ('e:first-of-type ' , '*/e[position() = 1] ' ),
115117 array ('e:last-of-type ' , '*/e[position() = last()] ' ),
116- array ('e:only-child ' , "*/*[name() = 'e' and (last() = 1)] " ),
118+ array ('e:only-child ' , "*/*[( name() = 'e') and (last() = 1)] " ),
117119 array ('e:only-of-type ' , 'e[last() = 1] ' ),
118120 array ('e:empty ' , 'e[not(*) and not(string-length())] ' ),
119121 array ('e:EmPTY ' , 'e[not(*) and not(string-length())] ' ),
@@ -127,7 +129,7 @@ public function getCssToXPathTestData()
127129 array ('e:nOT(*) ' , 'e[0] ' ),
128130 array ('e f ' , 'e/descendant-or-self::*/f ' ),
129131 array ('e > f ' , 'e/f ' ),
130- array ('e + f ' , "e/following-sibling::*[name() = 'f' and (position() = 1)] " ),
132+ array ('e + f ' , "e/following-sibling::*[( name() = 'f') and (position() = 1)] " ),
131133 array ('e ~ f ' , 'e/following-sibling::f ' ),
132134 array ('div#container p ' , "div[@id = 'container']/descendant-or-self::*/p " ),
133135 );
0 commit comments