Skip to content

Commit

Permalink
[fix] tooltips on svgs
Browse files Browse the repository at this point in the history
  • Loading branch information
sih44 committed Jun 6, 2017
1 parent ed9e2b7 commit 15605ba
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 21 deletions.
16 changes: 8 additions & 8 deletions dist/tippy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**!
* (c) 2017 atomiks (Tippy) & FezVrasta (Popper)
* @file tippy.js (popper.js 1.9.9 included) | Pure JS Tooltip Library
* @version 0.16.2
* @version 0.16.3
* @license MIT
*/

Expand Down Expand Up @@ -2318,7 +2318,7 @@ var _extends$1 = Object.assign || function (target) {

/**!
* @file tippy.js | Pure JS Tooltip Library
* @version 0.16.2
* @version 0.16.3
* @license MIT
*/

Expand All @@ -2344,7 +2344,6 @@ var SELECTORS = {
controller: '[data-tippy-controller]'
};

var hasInit = void 0;
var defaultSettings = void 0;
var defaultSettingsKeys = void 0;
var idCounter = 1;
Expand All @@ -2354,7 +2353,8 @@ var idCounter = 1;
*/
function init() {

hasInit = true;
if (init.done) return;
init.done = true;

// prefix will return either `transform`, `webkitTransform` or null
BROWSER.supported = !!prefix('transform');
Expand Down Expand Up @@ -2729,7 +2729,7 @@ function pushIntoStorage(ref) {
* @param {Element} el
*/
function removeTitle(el) {
var title = el.title;
var title = el.getAttribute('title');
el.setAttribute('data-original-title', title || 'html');
el.removeAttribute('title');
}
Expand Down Expand Up @@ -3044,7 +3044,7 @@ var Tippy$1 = function () {


// DOM is presumably mostly ready (for document.body) by instantiation time
if (!hasInit) init();
init();

// Use default browser tooltip on unsupported browsers
if (!BROWSER.supported) return;
Expand Down Expand Up @@ -3238,7 +3238,7 @@ var Tippy$1 = function () {
trigger = settings.trigger;


var title = el.title;
var title = el.getAttribute('title');
if (!title && !html) return;

var id = idCounter;
Expand Down Expand Up @@ -3534,7 +3534,7 @@ var Tippy$1 = function () {
if (html) {
content.innerHTML = html instanceof Element ? html.innerHTML : document.getElementById(html.replace('#', '')).innerHTML;
} else {
content.innerHTML = el.title || el.getAttribute('data-original-title');
content.innerHTML = el.getAttribute('title') || el.getAttribute('data-original-title');
removeTitle(el);
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/tippy.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/tippy.standalone.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ <h5 class="text-center text-muted"><span class="hidden-md-down">Hover your curso
<button class="btn tippy" title="I'm a big scary tooltip" data-theme="transparent" data-size="big">Big</button>

<button class="btn tippy" id="animated-tippy" title="Sticky tooltip! Click my element to hide me." data-theme="transparent" data-sticky="true" data-hideonclick="false" data-trigger="click">Animated element</button>

</div>
</section>

Expand Down
2 changes: 1 addition & 1 deletion docs/tippy/tippy.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tippy.js",
"version": "0.16.2",
"version": "0.16.3",
"description": "Pure JS Tooltip Library",
"main": "dist/tippy.js",
"scripts": {
Expand Down
18 changes: 9 additions & 9 deletions src/js/tippy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Popper from 'popper.js'

/**!
* @file tippy.js | Pure JS Tooltip Library
* @version 0.16.2
* @version 0.16.3
* @license MIT
*/

Expand All @@ -28,8 +28,7 @@ const SELECTORS = {
controller: '[data-tippy-controller]'
}

let hasInit,
defaultSettings,
let defaultSettings,
defaultSettingsKeys,
idCounter = 1

Expand All @@ -38,10 +37,11 @@ let hasInit,
*/
function init() {

hasInit = true
if (init.done) return
init.done = true

// prefix will return either `transform`, `webkitTransform` or null
BROWSER.supported = !!(prefix('transform'))
BROWSER.supported = !!prefix('transform')

if (!BROWSER.supported) return

Expand Down Expand Up @@ -420,7 +420,7 @@ function pushIntoStorage(ref) {
* @param {Element} el
*/
function removeTitle(el) {
const title = el.title
const title = el.getAttribute('title')
el.setAttribute('data-original-title', title || 'html')
el.removeAttribute('title')
}
Expand Down Expand Up @@ -737,7 +737,7 @@ class Tippy {
constructor(selector, settings = {}) {

// DOM is presumably mostly ready (for document.body) by instantiation time
if (!hasInit) init()
init()

// Use default browser tooltip on unsupported browsers
if (!BROWSER.supported) return
Expand Down Expand Up @@ -912,7 +912,7 @@ class Tippy {

const { html, trigger } = settings

const title = el.title
const title = el.getAttribute('title')
if (!title && !html) return

const id = idCounter
Expand Down Expand Up @@ -1161,7 +1161,7 @@ class Tippy {
? html.innerHTML
: document.getElementById(html.replace('#', '')).innerHTML
} else {
content.innerHTML = el.title || el.getAttribute('data-original-title')
content.innerHTML = el.getAttribute('title') || el.getAttribute('data-original-title')
removeTitle(el)
}
}
Expand Down

0 comments on commit 15605ba

Please sign in to comment.