From 01c6f9032792898c22b718f100ec88e4d8155ecf Mon Sep 17 00:00:00 2001
From: Marius Burkard <m.burkard@pixcept.de>
Date: Wed, 02 Mar 2016 05:19:14 -0500
Subject: [PATCH] - added line to guidelines

---
 interface/web/js/jquery.tipsy.js |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/interface/web/js/jquery.tipsy.js b/interface/web/js/jquery.tipsy.js
index 9567ed3..f95c063 100644
--- a/interface/web/js/jquery.tipsy.js
+++ b/interface/web/js/jquery.tipsy.js
@@ -9,6 +9,13 @@
         return (typeof thing == 'function') ? (thing.call(ctx)) : thing;
     };
     
+    function isElementInDOM(ele) {
+      while (ele = ele.parentNode) {
+        if (ele == document) return true;
+      }
+      return false;
+    };
+    
     function Tipsy(element, options) {
         this.$element = $(element);
         this.options = options;
@@ -104,6 +111,7 @@
         tip: function() {
             if (!this.$tip) {
                 this.$tip = $('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>');
+                this.$tip.data('tipsy-pointee', this.$element[0]);
             }
             return this.$tip;
         },
@@ -191,6 +199,15 @@
         trigger: 'hover'
     };
     
+    $.fn.tipsy.revalidate = function() {
+      $('.tipsy').each(function() {
+        var pointee = $.data(this, 'tipsy-pointee');
+        if (!pointee || !isElementInDOM(pointee)) {
+          $(this).remove();
+        }
+      });
+    };
+    
     // Overwrite this method to provide options on a per-element basis.
     // For example, you could store the gravity in a 'tipsy-gravity' attribute:
     // return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });

--
Gitblit v1.9.1