getElementsByTagName returns a NodeList, which has .length and can be indexed into with [], or item() if you prefer.
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE returns (an object) which has .snapshotLength and has to be indexed with snapshotItem(). The types of the objects returned by snapshotItem() depend on what tags they represent, eg HTMLLIElement, HTMLBodyElement; but these objects are all descendants of HTMLElement, Element and Node, so they can be supplied as the context node to another invocation of document.evaluate.
Insofar as JS has a type hierarchy, then a specific HTML element type, eg HTMLDivElement, 'is' a HTMLElement and a HTMLElement is an Element, and an Element is a Node.
NB that getElementById is so spelt (singular) and returns an Element, not a NodeList with 1 item. It genuinely expects there to be only one element with a given 'id'.
Anti-nuisance lawsuit warning: The purpose of these notes is to remind me, Zoegond, of stuff or to help me work stuff out. They may contain mistakes.
Quick
- ($a, $b....) = unpack("A2A7...", $packed)
- push( array, list )