Check for offsetElement before using it. It may not be set.