Skip to content

Instantly share code, notes, and snippets.

@timebomb0
Created December 26, 2019 21:34
Show Gist options
  • Save timebomb0/31c5a2a007f1443cf97c2ff03d894635 to your computer and use it in GitHub Desktop.
Save timebomb0/31c5a2a007f1443cf97c2ff03d894635 to your computer and use it in GitHub Desktop.
Method to programatically get tooltip content for Hordes.io instantly
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