bug fixes in hoveredElement in document
implemented mouse leave