zend-dom
zend-dom copied to clipboard
CSS query improperly converted to xpath
This issue has been moved from the zendframework repository as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html
Original Issue: https://api.github.com/repos/zendframework/zendframework/issues/7470 User: @fcheslack Created On: 2015-04-29T21:02:26Z Updated At: 2015-11-06T21:29:02Z Body In Zend\Dom\Document\Query, CSS selector strings with classes and attributes in the same segment are not properly converted to XPath.
"input.class[name='inputname']"
is converted to
input.classname[@name='inputname']
instead of
input[contains(concat(' ', normalize-space(@class), ' '), ' classname ')][@name='inputname']
This seems to be solved by simply moving the 'Classes' section of Query._tokenize to the top of the function before the "[@" it checks for is replaced into the expression by other steps. I'm not sure if it was placed as the last step for a reason though.
This repository has been closed and moved to laminas/laminas-dom; a new issue has been opened at https://github.com/laminas/laminas-dom/issues/3.