reverse childnodes

/** 
 * Reverse all child nodes inside an element
 * Example: reverseChildNodes(document.getElementById('test'))
 * @param DOMElement element
 * @return element
function reverseChildNodes(element) {
  var last = element.lastChild, prev = null;
  while(prev !== last) {
    prev = element.insertBefore(element.firstChild, prev);
  }
  return element;
}