The Document node does not have a tagName property, thereby we get an undefined tagName on the last call