Skip to content

Commit

Permalink
Don't show tooltips if the title is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Eliastik committed Oct 4, 2017
1 parent fba4c9e commit f3ff474
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 14 deletions.
7 changes: 4 additions & 3 deletions dist/bootstrap-native-v4.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Native Javascript for Bootstrap 4 v2.0.16 | © dnp_theme | MIT-License
// Native Javascript for Bootstrap 4 v2.0.17 | © dnp_theme | MIT-License
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD support:
Expand Down Expand Up @@ -1529,7 +1529,7 @@
var self = this, timer = 0, placementSetting = this[placement], tooltip = null,
titleString = element[getAttribute](title) || element[getAttribute](dataOriginalTitle);

if ( !titleString ) return; // invalidate
if ( !titleString || titleString == "" ) return; // invalidate

// private methods
var removeToolTip = function() {
Expand All @@ -1538,6 +1538,7 @@
},
createToolTip = function() {
titleString = element[getAttribute](title) || element[getAttribute](dataOriginalTitle); // read the title again
if ( !titleString || titleString == "" ) return false; // invalidate
tooltip = document.createElement(div);
tooltip[setAttribute]('role',component);

Expand Down Expand Up @@ -1579,7 +1580,7 @@
timer = setTimeout( function() {
if (tooltip === null) {
placementSetting = self[placement]; // we reset placement in all cases
createToolTip();
if(createToolTip() == false) return;
updateTooltip();
showTooltip();
bootstrapCustomEvent.call(element, showEvent, component);
Expand Down
4 changes: 2 additions & 2 deletions dist/bootstrap-native-v4.min.js

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions dist/bootstrap-native.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Native Javascript for Bootstrap 3 v2.0.16 | © dnp_theme | MIT-License
// Native Javascript for Bootstrap 3 v2.0.17 | © dnp_theme | MIT-License
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD support:
Expand Down Expand Up @@ -1673,7 +1673,7 @@
var self = this, timer = 0, placementSetting = this[placement], tooltip = null,
titleString = element[getAttribute](title) || element[getAttribute](dataOriginalTitle);

if ( !titleString ) return; // invalidate
if ( !titleString || titleString == "" ) return; // invalidate

// private methods
var removeToolTip = function() {
Expand All @@ -1682,6 +1682,8 @@
},
createToolTip = function() {
titleString = element[getAttribute](title) || element[getAttribute](dataOriginalTitle); // read the title again
if ( !titleString || titleString == "" ) return false; // invalidate

tooltip = document.createElement(div);
tooltip[setAttribute]('role',component);

Expand Down Expand Up @@ -1720,7 +1722,7 @@
timer = setTimeout( function() {
if (tooltip === null) {
placementSetting = self[placement]; // we reset placement in all cases
createToolTip();
if(createToolTip() == false) return;
updateTooltip();
showTooltip();
bootstrapCustomEvent.call(element, showEvent, component);
Expand Down
Loading

0 comments on commit f3ff474

Please sign in to comment.