From d594d6377a7e9cda399c25a450b0d27df704d939 Mon Sep 17 00:00:00 2001 From: Yohn Date: Sun, 23 Dec 2012 04:18:16 -0500 Subject: adding container option to tooltips --- js/bootstrap-tooltip.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'js') diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js index d908b0cf8..82fa96078 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: '' } -- cgit v1.2.3 From b6960d8cf9b3626b260bb41cb4454abc738ff46a Mon Sep 17 00:00:00 2001 From: Yohn Date: Sun, 23 Dec 2012 04:21:02 -0500 Subject: Update js/tests/unit/bootstrap-tooltip.js --- js/tests/unit/bootstrap-tooltip.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'js') diff --git a/js/tests/unit/bootstrap-tooltip.js b/js/tests/unit/bootstrap-tooltip.js index c44f75757..a2206f2d7 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') + }) }) -- cgit v1.2.3 From e867ae7b603f3882832143ff315c9ab3fd3b8f13 Mon Sep 17 00:00:00 2001 From: Yohn Date: Mon, 24 Dec 2012 18:07:41 -0500 Subject: removed the length check updated it to @fat's suggestion --- js/bootstrap-tooltip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js index 82fa96078..3ad8b6761 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() -- cgit v1.2.3 From 9835549faf3c00a9f7ce1aa0303c020cc603a4a6 Mon Sep 17 00:00:00 2001 From: Yohn Date: Mon, 24 Dec 2012 18:59:37 -0500 Subject: made container option be false --- js/bootstrap-tooltip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js index 3ad8b6761..48f9fcc6c 100644 --- a/js/bootstrap-tooltip.js +++ b/js/bootstrap-tooltip.js @@ -280,7 +280,7 @@ , title: '' , delay: 0 , html: false - , container: '' + , container: false } -- cgit v1.2.3