More optimisations. Use .childNodes instead of .children due to its dramatic speed difference in IE. Also use .attributes instead of get|has attribute functions as they're also faster.