From d594d6377a7e9cda399c25a450b0d27df704d939 Mon Sep 17 00:00:00 2001 From: Yohn Date: Sun, 23 Dec 2012 04:18:16 -0500 Subject: [PATCH 1/8] adding container option to tooltips --- js/bootstrap-tooltip.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js index d908b0cf8138..82fa96078956 100644 --- a/js/bootstrap-tooltip.js +++ b/js/bootstrap-tooltip.js @@ -126,7 +126,8 @@ $tip .detach() .css({ top: 0, left: 0, display: 'block' }) - .insertAfter(this.$element) + + this.options.container && $tip.appendTo(this.options.container).length || $tip.insertAfter(this.$element) pos = this.getPosition() @@ -279,6 +280,7 @@ , title: '' , delay: 0 , html: false + , container: '' } From b6960d8cf9b3626b260bb41cb4454abc738ff46a Mon Sep 17 00:00:00 2001 From: Yohn Date: Sun, 23 Dec 2012 04:21:02 -0500 Subject: [PATCH 2/8] Update js/tests/unit/bootstrap-tooltip.js --- js/tests/unit/bootstrap-tooltip.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/js/tests/unit/bootstrap-tooltip.js b/js/tests/unit/bootstrap-tooltip.js index c44f75757a16..a2206f2d7c83 100644 --- a/js/tests/unit/bootstrap-tooltip.js +++ b/js/tests/unit/bootstrap-tooltip.js @@ -164,4 +164,14 @@ $(function () { .tooltip('toggle') ok($(".tooltip").is('.fade.in'), 'tooltip should be toggled in') }) + + test("should place tooltips inside the body", function () { + var tooltip = $('') + .appendTo('#qunit-fixture') + .tooltip({container:'body'}) + .tooltip('show') + ok($("body > .tooltip").length, 'inside the body') + ok(!$("#qunit-fixture > .tooltip").length, 'not found in parent') + tooltip.tooltip('hide') + }) }) From 68ff08cc914c49461cba41debc71e24564852866 Mon Sep 17 00:00:00 2001 From: Yohn Date: Sun, 23 Dec 2012 04:23:18 -0500 Subject: [PATCH 3/8] Update docs/templates/pages/javascript.mustache --- docs/templates/pages/javascript.mustache | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/templates/pages/javascript.mustache b/docs/templates/pages/javascript.mustache index 809e34ce9c12..52a7f9fd9280 100644 --- a/docs/templates/pages/javascript.mustache +++ b/docs/templates/pages/javascript.mustache @@ -779,6 +779,15 @@ $('a[data-toggle="tab"]').on('shown', function (e) {

{{_i}}Object structure is: delay: { show: 500, hide: 100 }{{/i}}

+ + {{_i}}container{{/i}} + {{_i}}string{{/i}} + '' + +

{{_i}}Usefull if your tooltip is within a btn-group or modal{{/i}}

+

{{_i}}Appends the tooltip to a specific element container: '#Modal'{{/i}}

+ +
From f152dead9216fc870c58cd4b272edc21c6545edc Mon Sep 17 00:00:00 2001 From: Yohn Date: Sun, 23 Dec 2012 04:25:27 -0500 Subject: [PATCH 4/8] Update docs/javascript.html --- docs/javascript.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/javascript.html b/docs/javascript.html index 95cd6d5e64bf..88197a5cc3ac 100644 --- a/docs/javascript.html +++ b/docs/javascript.html @@ -849,6 +849,15 @@

Options

Object structure is: delay: { show: 500, hide: 100 }

+ + container + string + '' + +

Usefull if your tooltip is within a btn-group or modal

+

Appends the tooltip to a specific element container: '#Modal'

+ +
From e867ae7b603f3882832143ff315c9ab3fd3b8f13 Mon Sep 17 00:00:00 2001 From: Yohn Date: Mon, 24 Dec 2012 18:07:41 -0500 Subject: [PATCH 5/8] removed the length check updated it to @fat's suggestion --- js/bootstrap-tooltip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js index 82fa96078956..3ad8b6761875 100644 --- a/js/bootstrap-tooltip.js +++ b/js/bootstrap-tooltip.js @@ -127,7 +127,7 @@ .detach() .css({ top: 0, left: 0, display: 'block' }) - this.options.container && $tip.appendTo(this.options.container).length || $tip.insertAfter(this.$element) + this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) pos = this.getPosition() From 9835549faf3c00a9f7ce1aa0303c020cc603a4a6 Mon Sep 17 00:00:00 2001 From: Yohn Date: Mon, 24 Dec 2012 18:59:37 -0500 Subject: [PATCH 6/8] made container option be false --- js/bootstrap-tooltip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js index 3ad8b6761875..48f9fcc6caed 100644 --- a/js/bootstrap-tooltip.js +++ b/js/bootstrap-tooltip.js @@ -280,7 +280,7 @@ , title: '' , delay: 0 , html: false - , container: '' + , container: false } From 2a5fde272cf9094a9b28afd1de2f5a473febc958 Mon Sep 17 00:00:00 2001 From: Yohn Date: Mon, 24 Dec 2012 19:01:56 -0500 Subject: [PATCH 7/8] Update docs/javascript.html --- docs/javascript.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/javascript.html b/docs/javascript.html index 88197a5cc3ac..b3d4481d94f3 100644 --- a/docs/javascript.html +++ b/docs/javascript.html @@ -851,11 +851,10 @@

Options

container - string - '' + string | false + false -

Usefull if your tooltip is within a btn-group or modal

-

Appends the tooltip to a specific element container: '#Modal'

+

Appends the tooltip to a specific element container: 'body'

From 340d90138c86bdd86e74712d53c776c77f17c477 Mon Sep 17 00:00:00 2001 From: Yohn Date: Mon, 24 Dec 2012 19:03:13 -0500 Subject: [PATCH 8/8] Update docs/templates/pages/javascript.mustache --- docs/templates/pages/javascript.mustache | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/templates/pages/javascript.mustache b/docs/templates/pages/javascript.mustache index 52a7f9fd9280..499fed48d16f 100644 --- a/docs/templates/pages/javascript.mustache +++ b/docs/templates/pages/javascript.mustache @@ -781,11 +781,10 @@ $('a[data-toggle="tab"]').on('shown', function (e) { {{_i}}container{{/i}} - {{_i}}string{{/i}} - '' + {{_i}}string | false{{/i}} + {{_i}}false{{/i}} -

{{_i}}Usefull if your tooltip is within a btn-group or modal{{/i}}

-

{{_i}}Appends the tooltip to a specific element container: '#Modal'{{/i}}

+

{{_i}}Appends the tooltip to a specific element container: 'body'{{/i}}