Permalink
Browse files

Remove useless tooltip caching...wat was I thinking?

  • Loading branch information...
1 parent d52eea1 commit 52a3d3c90f10731da8f98ecb0bc12bf316cf8324 @caseywebdev committed Mar 18, 2013
Showing with 11 additions and 66 deletions.
  1. +5 −22 dist/jquery-cwd.js
  2. +5 −22 dist/tooltip.js
  3. +1 −22 lib/tooltip.coffee
View
27 dist/jquery-cwd.js
@@ -769,7 +769,6 @@
});
Tooltip = {
- $els: $(),
mouse: {
x: 0,
y: 0
@@ -815,8 +814,6 @@
if (options == null) {
options = {};
}
- Tooltip.remove($els);
- Tooltip.$els = Tooltip.$els.add($els);
$els.data({
tooltipHtml: (_ref = options.html) != null ? _ref : '',
tooltipPosition: (_ref1 = options.position) != null ? _ref1 : 'top',
@@ -840,16 +837,6 @@
}
return $els;
},
- remove: function($els) {
- Tooltip.$els = Tooltip.$els.not($els);
- return $els.data({
- tooltipHover: false,
- tooltipHoverableHover: false
- }).off(Tooltip.listeners).each(function() {
- var _ref;
- return (_ref = $(this).data().tooltip$Div) != null ? _ref.remove() : void 0;
- });
- },
divFor: function($t) {
var $div, position;
if (!$t.data('tooltip$Div')) {
@@ -1011,15 +998,11 @@
}
});
},
- removeTooltip: function(soft) {
- if (soft) {
- return $(this).each(function() {
- var _ref;
- return (_ref = $(this).data().tooltip$Div) != null ? _ref.remove() : void 0;
- });
- } else {
- return Tooltip.remove($(this));
- }
+ resetTooltip: function() {
+ return $(this).each(function() {
+ var _ref;
+ return (_ref = $(this).data().tooltip$Div) != null ? _ref.remove() : void 0;
+ });
}
});
View
27 dist/tooltip.js
@@ -3,7 +3,6 @@
var Tooltip;
Tooltip = {
- $els: $(),
mouse: {
x: 0,
y: 0
@@ -49,8 +48,6 @@
if (options == null) {
options = {};
}
- Tooltip.remove($els);
- Tooltip.$els = Tooltip.$els.add($els);
$els.data({
tooltipHtml: (_ref = options.html) != null ? _ref : '',
tooltipPosition: (_ref1 = options.position) != null ? _ref1 : 'top',
@@ -74,16 +71,6 @@
}
return $els;
},
- remove: function($els) {
- Tooltip.$els = Tooltip.$els.not($els);
- return $els.data({
- tooltipHover: false,
- tooltipHoverableHover: false
- }).off(Tooltip.listeners).each(function() {
- var _ref;
- return (_ref = $(this).data().tooltip$Div) != null ? _ref.remove() : void 0;
- });
- },
divFor: function($t) {
var $div, position;
if (!$t.data('tooltip$Div')) {
@@ -245,15 +232,11 @@
}
});
},
- removeTooltip: function(soft) {
- if (soft) {
- return $(this).each(function() {
- var _ref;
- return (_ref = $(this).data().tooltip$Div) != null ? _ref.remove() : void 0;
- });
- } else {
- return Tooltip.remove($(this));
- }
+ resetTooltip: function() {
+ return $(this).each(function() {
+ var _ref;
+ return (_ref = $(this).data().tooltip$Div) != null ? _ref.remove() : void 0;
+ });
}
});
View
23 lib/tooltip.coffee
@@ -1,9 +1,6 @@
# Yay tooltips!
Tooltip =
- # Keep track of the elements we want to update
- $els: $()
-
# Store mouse coordinates
mouse:
x: 0
@@ -34,8 +31,6 @@ Tooltip =
blur: -> Tooltip.hide $ @
add: ($els, options = {}) ->
- Tooltip.remove $els
- Tooltip.$els = Tooltip.$els.add $els
$els.data
tooltipHtml: options.html ? ''
tooltipPosition: options.position ? 'top'
@@ -54,17 +49,6 @@ Tooltip =
$els.on 'blur', Tooltip.listeners.blur
$els
- remove: ($els) ->
- Tooltip.$els = Tooltip.$els.not $els
- $els
- .data(
- tooltipHover: false
- tooltipHoverableHover: false
- )
- .off(Tooltip.listeners)
- .each ->
- $(@).data().tooltip$Div?.remove()
-
# Get the current tooltip$Div for an item or create a new one and return that
divFor: ($t) ->
unless $t.data 'tooltip$Div'
@@ -215,9 +199,4 @@ $.extend $.fn,
$div.css Tooltip.position($t).home
# Use this to remove a tooltip
- removeTooltip: (soft) ->
- if soft
- $(@).each ->
- $(@).data().tooltip$Div?.remove()
- else
- Tooltip.remove $ @
+ resetTooltip: -> $(@).each -> $(@).data().tooltip$Div?.remove()

0 comments on commit 52a3d3c

Please sign in to comment.