Enhanced element and elements functions

* element() performed the call to elements twice, this has now been fixed
  to make use of the matches variable.
* element() and elements() now take root/parent nodes as an optional
  argument to assist in speeding up element searching where required.