Created
December 26, 2019 21:34
-
-
Save timebomb0/31c5a2a007f1443cf97c2ff03d894635 to your computer and use it in GitHub Desktop.
Method to programatically get tooltip content for Hordes.io instantly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getTooltipNode = async ($elementToHoverOver) => { | |
$elementToHoverOver.dispatchEvent(new Event('pointerenter')); | |
const closeTooltipPromise = new Promise(resolve => setTimeout(() => { | |
resolve($elementToHoverOver.querySelector('.slotdescription').cloneNode(true)); | |
$elementToHoverOver.dispatchEvent(new Event('pointerleave')); | |
}, 0)); | |
const $tooltip = await closeTooltipPromise; | |
return $tooltip; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment