Small performance tweaks for commonly called functions

* Use numeric constants instead of variable dereferences
* locally define isElt 
* use the nodeType in isComment

Change-Id: I8f3a784b089b90619809ebc49268a0be482ad753
Merge "Small performance tweaks for commonly called functions"