aboutsummaryrefslogtreecommitdiff
path: root/dist/js/bootstrap.js
diff options
context:
space:
mode:
authorChris Rebert <[email protected]>2014-05-23 14:11:15 -0700
committerChris Rebert <[email protected]>2014-05-23 14:11:15 -0700
commitef6225491729ee3ec3804250e3dddb69cc95fba0 (patch)
tree78ccf7531d9dc79343ac370bc36a2e763f42d858 /dist/js/bootstrap.js
parent66bc4d1c677cf83032c4b40563630910c911aca9 (diff)
parenta70da16f6fb8c665f22b78b49a1dff998f1da8a7 (diff)
downloadbootstrap-ef6225491729ee3ec3804250e3dddb69cc95fba0.tar.xz
bootstrap-ef6225491729ee3ec3804250e3dddb69cc95fba0.zip
Merge pull request #13557 from bassettsj/aria-describedby-tooltip-13480
Aria describedby tooltip: #13480
Diffstat (limited to 'dist/js/bootstrap.js')
-rw-r--r--dist/js/bootstrap.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/dist/js/bootstrap.js b/dist/js/bootstrap.js
index 02cbb5c1c..f6654d9db 100644
--- a/dist/js/bootstrap.js
+++ b/dist/js/bootstrap.js
@@ -1233,7 +1233,11 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var $tip = this.tip()
+ var tipId = this.getUID(this.type)
+
this.setContent()
+ $tip.attr('id', tipId)
+ this.$element.attr('aria-describedby', tipId)
if (this.options.animation) $tip.addClass('fade')
@@ -1356,6 +1360,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
var $tip = this.tip()
var e = $.Event('hide.bs.' + this.type)
+ this.$element.removeAttr('aria-describedby')
+
function complete() {
if (that.hoverState != 'in') $tip.detach()
that.$element.trigger('hidden.bs.' + that.type)
@@ -1447,6 +1453,12 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
return title
}
+ Tooltip.prototype.getUID = function (prefix) {
+ do prefix += ~~(Math.random() * 1000000)
+ while (document.getElementById(prefix))
+ return prefix
+ }
+
Tooltip.prototype.tip = function () {
return this.$tip = this.$tip || $(this.options.template)
}