briancray / tooltipsy

Introducing a jQuery tooltip plugin for control-obsessed designers.
http://tooltipsy.com
MIT License
325 stars 97 forks source link

Check if the element where the handler was attached is still present before triggering the 'show' (for tooltips with delay) #30

Open rafaelchiti opened 10 years ago

rafaelchiti commented 10 years ago

Maybe I'm doing something wrong, but imagine you have a list of elements and each item has its own sub item that allow the user to 'remove' that item from the list. I attach a tooltip to each item with a delay, but the user can just get into the iteam with the mouse to click the 'remove' link, what happen is that tooltipsy will call the 'show' method when the timeout finishes the time delay and by then the 'item' does not exist anymore cause my logic removed it from the UI.

Would it be nice for the plugin in the first lines of the 'show' method to check if the item is still present in the DOM and from there execute the whole logic?. Again I had to do some crazy stuff with the UI but I guess is a common scenario when you set the tooltip to an element that can be removed, by the time the setTimeout reaches the 'show' method maybe the element does not exist anymore.