4 ms·
What in jQuery is a chain of multiple selectors and filters, can be done using single query in XPath, i.e. "document()/html//div[class='title']//img[class='
by nivertech 16y ago
What in jQuery is a chain of multiple selectors and filters, can be done using single query in XPath, i.e.
"document()/html//div[class='title']//img[class='icon']/@src"
- Groxx 16y agoI gather you haven't done much jQuery coding. That's equivalent to: $("html div.title img.icon").attr("src") The last .attr("src") is purely because jQuery always deals with a node / a collection of nodes. You can also do arbitrary attribute searches: $("html div[class~='title'] img[src*='google']") // "~=" == "contains word" - space-delimited to match html classes // "*=" == "contains substring" http://api.jquery.com/category/selectors/ http://api.jquery.com/category/selectors/
- nailer 16y agoYou're right, but jquery doesn't handle XML namespaces. Alas I wish it did.