Which is better to use when iterating over DOM elements or finding a a set of DOM elements. is Xpath faster?
thanks for your input
aaron
2010-02-09 19:11:16
A:
If you want to find a group of elements that are at different hiearchical levels and different attributes of interest then you should use Xpath.
If you just want to "iterate" one by one over a set of elements then just use the iterator.
Harley Green
2010-02-09 17:10:11
A:
The dojo team did some research about when XPath is faster for their dojo.query
interface.
See their Blog Post about it.
Kyle Butt
2010-02-09 17:57:32
A:
according to this post "The DOM traversal code is about four times faster than the XPath code." http://www.sklar.com/blog/archives/85-Speed-DOM-traversal-vs.-XPath-in-PHP-5.html
schrödinger
2010-05-01 09:01:54