css_to_xpath translates [d|="" i], and p[lang|=""] (HTML compares lang values case-insensitively), into translate(@d, ...) = '' or starts-with(...), which is true for an element without the attribute because string() of an empty node-set is the empty string. On <div><p id=none/><p id=empty d=""/><p id=dash d="-x"/></div>, select('[d|="" i]') returns empty and dash, while the XPath on lxml 6.1.3 also returns the div and none.
Selectors 4 matches [att|=val] only on elements that have att. #1086 added the presence guard for =; |= needs the same one. cssselect 1.5.0 guards every |= match on the attribute.
css_to_xpathtranslates[d|="" i], andp[lang|=""](HTML compareslangvalues case-insensitively), intotranslate(@d, ...) = '' or starts-with(...), which is true for an element without the attribute becausestring()of an empty node-set is the empty string. On<div><p id=none/><p id=empty d=""/><p id=dash d="-x"/></div>,select('[d|="" i]')returnsemptyanddash, while the XPath on lxml 6.1.3 also returns thedivandnone.Selectors 4 matches
[att|=val]only on elements that haveatt. #1086 added the presence guard for=;|=needs the same one. cssselect 1.5.0 guards every|=match on the attribute.