The getElementsByTagName method of The complete document is searched, including the root node.
getElementsByTagName
MDN Reference