We convert the queries to use xpath, which works for html documents, but it doesn't work for xhtml. In case of xhtml we would need to provide a namespace resolver and elements would need to be prefixed with xhtml: I would be a lot easier to simply iterate the link elements and copare the text.
Created attachment 327971 [details] Patch
Comment on attachment 327971 [details] Patch r=me Oh well for trying to be clever!
Committed r225388: <https://trac.webkit.org/changeset/225388>
<rdar://problem/35793604>