While converting CSS class selectors into XPath expressions white spaces are not correctly handled: the current code appends a starting space and trailing one to the class attribute value and does the same with the class value being processed. This approach works only if there is only a space separating every class value, but in more complex cases the resulting XPath expressions does not select element the should be matched, e.g.:
<style type="text/css">
<!--
.value1 {
background: red;
}
-->
</style>
<!-- a newline is separating the class values! -->
<body class="value1
value2">
...
</body>
In this case the body element is not matched by the following XPath expression:
//*[contains(concat(" ",@class," "),concat(" ","value1"," "))]
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | mimemail-729334-1.patch | 926 bytes | plach |
Comments
Comment #1
plachThe attached patch should fix the issue by normalizing white spaces in the class attribute value.
Comment #2
sgabe commentedI can confirm this issue. The patch works as advertised.
Comment #3
sgabe commentedCommitted to HEAD.