do you think you could rewrite this loop like this:

for (var currentChild = element.firstChild; currentChild; currentChild = currentChild.nextSibling) {
}

A jsperf test showed me it was faster (even if in this case it's probably marginal)