Thursday 03 June, 2010 by justinbmeyer Being able to quickly compare two elements' positions in the browser is extremely useful for a variety of tasks. The DOM Level 3 specification describes the compareDocumentPosition method. It returns a bitmask with a whole bunch of useful information. But not all browsers support it :( For a really solid walkthrough of compareDocumentPosition, check out John