Calculate the position of an element relative to another element or event. It has also functionality to handle collision within the viewport of a given container. It does not manipulate CSS or DOM, it only calculates values. It is a basic technology to support implementation of tooltips, popups, popovers, scrollspies, sticky navi and many more.
Get the first element(s) that matches the selector by traversing down through descendants in the DOM tree level by level. It use a breadth first search (BFS), that mean it will stop going deeper in a subtree if the first matching descendant was found in the current subtree.