Document guidelines for getElementsByTagNameNS and optimize all usages

Adds documentation as requested. Fixed #736.
Is this a bugfix? If not, why switch to the slower version?