Make document.getElementsByTagname return a NodeList; consolidate element collection to collectElement; fix #1744

improve

Make document.getElementsByTagname return a NodeList; consolidate element collection to collectElement; fix #1744