From f836473129819c2e348f821ed268451b9b8bf2e4 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Sat, 2 Jun 2012 17:55:10 -0700 Subject: add html option back to tooltip and popover to explicitly prevent XSS #3421 --- js/bootstrap-tooltip.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'js/bootstrap-tooltip.js') diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js index b476f1c4e..f5f9fad3f 100644 --- a/js/bootstrap-tooltip.js +++ b/js/bootstrap-tooltip.js @@ -148,20 +148,11 @@ } } - , isHTML: function(text) { - // html string detection logic adapted from jQuery - return typeof text != 'string' - || ( text.charAt(0) === "<" - && text.charAt( text.length - 1 ) === ">" - && text.length >= 3 - ) || /^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(text) - } - , setContent: function () { var $tip = this.tip() , title = this.getTitle() - $tip.find('.tooltip-inner')[this.isHTML(title) ? 'html' : 'text'](title) + $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) $tip.removeClass('fade in top bottom left right') } @@ -270,6 +261,7 @@ , trigger: 'hover' , title: '' , delay: 0 + , html: true } }(window.jQuery); -- cgit v1.2.3 From 6a974f9ff7962afc9aaf5510055e574d147a6c42 Mon Sep 17 00:00:00 2001 From: Jon Stevens Date: Mon, 18 Jun 2012 19:25:54 -0700 Subject: enable the ability to destroy tooltips and popovers from elements. related to issue #3453 --- js/bootstrap-tooltip.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'js/bootstrap-tooltip.js') diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js index f5f9fad3f..93525b8bd 100644 --- a/js/bootstrap-tooltip.js +++ b/js/bootstrap-tooltip.js @@ -235,6 +235,12 @@ this[this.tip().hasClass('in') ? 'hide' : 'show']() } + , destroy: function () { + var $e = this.$element + $e.off() + $e.removeData('tooltip') + } + } -- cgit v1.2.3 From 3a5b4cc7df5f63b39218fbae75d6604e08f89e2a Mon Sep 17 00:00:00 2001 From: Jon Stevens Date: Wed, 20 Jun 2012 10:42:25 -0700 Subject: simplify code into a single line --- js/bootstrap-tooltip.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'js/bootstrap-tooltip.js') diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js index 93525b8bd..f280e3696 100644 --- a/js/bootstrap-tooltip.js +++ b/js/bootstrap-tooltip.js @@ -236,9 +236,7 @@ } , destroy: function () { - var $e = this.$element - $e.off() - $e.removeData('tooltip') + this.$element.off().removeData('tooltip') } } -- cgit v1.2.3 From 2ee9b2717bfd532e93eb6d4037ae7ca7a5436957 Mon Sep 17 00:00:00 2001 From: Jon Stevens Date: Mon, 16 Jul 2012 16:01:11 -0700 Subject: namespace the events for popover/tooltip so that they can be cleanly removed. issue #3880 --- js/bootstrap-tooltip.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'js/bootstrap-tooltip.js') diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js index f280e3696..02f84d470 100644 --- a/js/bootstrap-tooltip.js +++ b/js/bootstrap-tooltip.js @@ -47,8 +47,8 @@ if (this.options.trigger != 'manual') { eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus' eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur' - this.$element.on(eventIn, this.options.selector, $.proxy(this.enter, this)) - this.$element.on(eventOut, this.options.selector, $.proxy(this.leave, this)) + this.$element.on(eventIn + this.options.ns, this.options.selector, $.proxy(this.enter, this)) + this.$element.on(eventOut + this.options.ns, this.options.selector, $.proxy(this.leave, this)) } this.options.selector ? @@ -236,7 +236,7 @@ } , destroy: function () { - this.$element.off().removeData('tooltip') + this.$element.off(this.options.ns).removeData('tooltip') } } @@ -266,6 +266,7 @@ , title: '' , delay: 0 , html: true + , ns: '.tooltip' } }(window.jQuery); -- cgit v1.2.3 From 117f65d43108d5d7ff1c5011f0b8b61f7ef3b9dd Mon Sep 17 00:00:00 2001 From: Jon Stevens Date: Fri, 20 Jul 2012 09:47:12 -0700 Subject: on destroy, also hide. issue #3880, pull #4104 --- js/bootstrap-tooltip.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js/bootstrap-tooltip.js') diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js index 02f84d470..f22aa8e64 100644 --- a/js/bootstrap-tooltip.js +++ b/js/bootstrap-tooltip.js @@ -236,6 +236,7 @@ } , destroy: function () { + this.hide() this.$element.off(this.options.ns).removeData('tooltip') } -- cgit v1.2.3 From 393f4a7b4244233a6ad24a48b68869329f4756b8 Mon Sep 17 00:00:00 2001 From: Jon Stevens Date: Sun, 22 Jul 2012 14:19:11 -0700 Subject: simplify things to one line. pull #4104 --- js/bootstrap-tooltip.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'js/bootstrap-tooltip.js') diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js index f22aa8e64..fa1c9a6c5 100644 --- a/js/bootstrap-tooltip.js +++ b/js/bootstrap-tooltip.js @@ -176,6 +176,8 @@ $.support.transition && this.$tip.hasClass('fade') ? removeWithAnimation() : $tip.remove() + + return this } , fixTitle: function () { @@ -236,8 +238,7 @@ } , destroy: function () { - this.hide() - this.$element.off(this.options.ns).removeData('tooltip') + this.hide().$element.off(this.options.ns).removeData('tooltip') } } -- cgit v1.2.3 From d76c8991424b91050636fb94e740daa123306e95 Mon Sep 17 00:00:00 2001 From: Jon Stevens Date: Sun, 22 Jul 2012 14:36:23 -0700 Subject: remove the ns option --- js/bootstrap-tooltip.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'js/bootstrap-tooltip.js') diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js index fa1c9a6c5..f9447410e 100644 --- a/js/bootstrap-tooltip.js +++ b/js/bootstrap-tooltip.js @@ -47,8 +47,8 @@ if (this.options.trigger != 'manual') { eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus' eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur' - this.$element.on(eventIn + this.options.ns, this.options.selector, $.proxy(this.enter, this)) - this.$element.on(eventOut + this.options.ns, this.options.selector, $.proxy(this.leave, this)) + this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) + this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) } this.options.selector ? @@ -238,7 +238,7 @@ } , destroy: function () { - this.hide().$element.off(this.options.ns).removeData('tooltip') + this.hide().$element.off('.' + this.type).removeData(this.type) } } @@ -268,7 +268,6 @@ , title: '' , delay: 0 , html: true - , ns: '.tooltip' } }(window.jQuery); -- cgit v1.2.3 From dcf75697ecd243517b23d8ef440f772d91f699c0 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Sun, 22 Jul 2012 18:28:39 -0700 Subject: some progress on affix plugin --- js/bootstrap-tooltip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/bootstrap-tooltip.js') diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js index f9447410e..1e681627a 100644 --- a/js/bootstrap-tooltip.js +++ b/js/bootstrap-tooltip.js @@ -176,7 +176,7 @@ $.support.transition && this.$tip.hasClass('fade') ? removeWithAnimation() : $tip.remove() - + return this } -- cgit v1.2.3 From 45dddc59a19f3e9decaa4bf0e0db3f884a0f6ff7 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Sat, 18 Aug 2012 19:54:30 -0700 Subject: add click option for tooltip, popover - make click default for popover --- js/bootstrap-tooltip.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'js/bootstrap-tooltip.js') diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js index 1e681627a..0b3230bc1 100644 --- a/js/bootstrap-tooltip.js +++ b/js/bootstrap-tooltip.js @@ -44,8 +44,10 @@ this.options = this.getOptions(options) this.enabled = true - if (this.options.trigger != 'manual') { - eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus' + if (this.options.trigger == 'click') { + this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) + } else if (this.options.trigger != 'manual') { + eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus' eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur' this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) -- cgit v1.2.3 From e510306196b6433dc73302d24ca58313d3a31ec7 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Sun, 19 Aug 2012 23:07:18 -0700 Subject: bump versions to 2.1.0 --- js/bootstrap-tooltip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/bootstrap-tooltip.js') diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js index 0b3230bc1..4d06dfcc9 100644 --- a/js/bootstrap-tooltip.js +++ b/js/bootstrap-tooltip.js @@ -1,5 +1,5 @@ /* =========================================================== - * bootstrap-tooltip.js v2.0.4 + * bootstrap-tooltip.js v2.1.0 * http://twitter.github.com/bootstrap/javascript.html#tooltips * Inspired by the original jQuery.tipsy by Jason Frame * =========================================================== -- cgit v1.2.3