Speed up XPath execution
Speed up XPath execution

JSON.stringify calls in two nested cycles are very resource-intensive.
However, the returned value of these calls is the same during loops.
It seems they could be moved outside the loops safely.

Fixes #1473.

fiftin/jsdom,mzgol/jsdom,fiftin/jsdom,Joris-van-der-Wel/jsdom,Zirro/jsdom,tmpvar/jsdom,tmpvar/jsdom,fiftin/jsdom,snuggs/jsdom,Joris-van-der-Wel/jsdom,snuggs/jsdom,Zirro/jsdom,mzgol/jsdom,Joris-van-der-Wel/jsdom,mzgol/jsdom