@atlassian/tipsy
Advanced tools
Comparing version 1.1.0 to 1.2.0
{ | ||
"name": "@atlassian/tipsy", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Atlassian fork of tipsy", | ||
@@ -19,3 +19,3 @@ "main": "src/javascripts/jquery.tipsy.js", | ||
], | ||
"author": "Atlassian", | ||
"author": "Jason Frame <jason@onehackoranother.com>", | ||
"license": "MIT", | ||
@@ -22,0 +22,0 @@ "bugs": { |
# tipsy | ||
Facebook-style tooltip plugin for jQuery | ||
Facebook-style tooltip plugin for jQuery. | ||
@@ -13,17 +13,11 @@ (c) 2008-2010 Jason Frame (jason@onehackoranother.com) | ||
It's used by Twitter, Github, Slideshare and Bitbucket, amongst others. | ||
## Homepage: | ||
http://onehackoranother.com/projects/jquery/tipsy | ||
## Source: | ||
Hosted at GitHub; browse at: | ||
Hosted at Github; browse at: | ||
http://github.com/jaz303/tipsy/tree/master | ||
http://github.com/atlassian/tipsy/ | ||
Or clone from: | ||
git://github.com/jaz303/tipsy.git | ||
git://github.com/atlassian/tipsy.git | ||
@@ -30,0 +24,0 @@ ## Usage: |
@@ -10,3 +10,6 @@ // tipsy, facebook style tooltips for jquery | ||
(function($) { | ||
var liveBindingWarning = "To be compatible with jQuery 1.9 and higher," | ||
" You must pass a selector to tipsy's live argument." + | ||
" For instance, `$(document).tipsy({live: 'a.live'});`"; | ||
function maybeCall(thing, ctx) { | ||
@@ -17,6 +20,4 @@ return (typeof thing == 'function') ? (thing.call(ctx)) : thing; | ||
function isElementInDOM(ele) { | ||
while (ele = ele.parentNode) { | ||
if (ele == document) return true; | ||
} | ||
return false; | ||
var el = ele && ele.jquery ? ele.get(0) : ele; | ||
return $.contains(document.documentElement, el); | ||
}; | ||
@@ -40,3 +41,3 @@ | ||
// if element is not in the DOM then don't show the Tipsy and return early | ||
if (!isElementInDOM(this.$element[0])) { | ||
if (!isElementInDOM(this.$element)) { | ||
return; | ||
@@ -150,8 +151,8 @@ } | ||
if(this.options.live){ | ||
$(this.$element.context).off('.tipsy'); | ||
$(document).off('.tipsy', this.options.live); | ||
} else { | ||
this.$element.unbind('.tipsy'); | ||
this.$element.off('.tipsy'); | ||
} | ||
}, | ||
hide: function() { | ||
@@ -223,3 +224,15 @@ if (this.options.fade) { | ||
} | ||
// Check for jQuery support and patch live binding for jQuery 3 compat. | ||
if (options.live === true) { | ||
if (!this.selector) { | ||
// No more jQuery support! | ||
throw new Error(liveBindingWarning); | ||
} else { | ||
// Deprecated behaviour | ||
console && console.warn && console.warn(liveBindingWarning); | ||
options.live = this.selector; | ||
} | ||
} | ||
function get(ele) { | ||
@@ -241,6 +254,10 @@ var tipsy = $.data(ele, 'tipsy'); | ||
tipsy.fixTitle(); | ||
setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn); | ||
setTimeout(function() { | ||
if (tipsy.hoverState == 'in' && isElementInDOM(tipsy.$element)) { | ||
tipsy.show(); | ||
} | ||
}, options.delayIn); | ||
} | ||
}; | ||
function leave() { | ||
@@ -252,3 +269,7 @@ var tipsy = get(this); | ||
} else { | ||
setTimeout(function() { if (tipsy.hoverState == 'out' && !tipsy.hoverTooltip) tipsy.hide(); }, options.delayOut); | ||
setTimeout(function() { | ||
if (tipsy.hoverState == 'out' && !tipsy.hoverTooltip) { | ||
tipsy.hide(); | ||
} | ||
}, options.delayOut); | ||
} | ||
@@ -263,5 +284,9 @@ }; | ||
if (options.live) { | ||
$(this.context).on(eventIn, this.selector, enter).on(eventOut, this.selector, leave); | ||
$(document) | ||
.on(eventIn, options.live, enter) | ||
.on(eventOut, options.live, leave) | ||
} else { | ||
this.bind(eventIn, enter).bind(eventOut, leave); | ||
this | ||
.on(eventIn, enter) | ||
.on(eventOut, leave) | ||
} | ||
@@ -268,0 +293,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33580
10
344
45