Performance tweak : avoid calling .length in a loop.

jsdom has defined getters on "length" (on NodeList and AttributeList) which are somewhat expensive to call