use contain instead of compareDocumentPosition in overlay