From 2ae4c0b03f7fde62f99ea8324859fa60cd890163 Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Mon, 29 Dec 2014 12:02:32 -0800 Subject: JSCS: enable requireSpaceBetweenArguments New rule added in JSCS v1.9.0 Our JS already complies with this. --- js/.jscsrc | 1 + 1 file changed, 1 insertion(+) (limited to 'js') diff --git a/js/.jscsrc b/js/.jscsrc index 9612c1683..ac1d73f55 100644 --- a/js/.jscsrc +++ b/js/.jscsrc @@ -22,6 +22,7 @@ "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"], "requireSpaceAfterLineComment": true, "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", "<", ">=", "<="], + "requireSpaceBetweenArguments": true, "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningCurlyBrace": true, "beforeOpeningRoundBrace": true }, "requireSpacesInConditionalExpression": true, "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, -- cgit v1.2.3 From 27bfef5b35f3e12af8beb7140e3b19bb6a3b3a75 Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Mon, 22 Dec 2014 14:02:31 -0800 Subject: Add regression test for #14244. Special thanks to @programcsharp [skip validator] --- js/tests/unit/popover.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'js') diff --git a/js/tests/unit/popover.js b/js/tests/unit/popover.js index 466ebace2..4b8b2a96b 100644 --- a/js/tests/unit/popover.js +++ b/js/tests/unit/popover.js @@ -217,4 +217,42 @@ $(function () { $div.find('a.second').click() equal($('.popover').length, 0, 'second popover removed') }) + + test('should detach popover content rather than removing it so that event handlers are left intact', function () { + var $content = $('').appendTo('#qunit-fixture') + + var handlerCalled = false; + $('.content-with-handler .btn').click(function () { + handlerCalled = true + }); + + var $div = $('
Show popover
') + .appendTo('#qunit-fixture') + .bootstrapPopover({ + html: true, + trigger: 'manual', + container: 'body', + content: function () { + return $content; + } + }) + + stop() + $div + .one('shown.bs.popover', function () { + $div + .one('hidden.bs.popover', function () { + $div + .one('shown.bs.popover', function () { + $('.content-with-handler .btn').click() + $div.bootstrapPopover('destroy') + ok(handlerCalled, 'content\'s event handler still present') + start() + }) + .bootstrapPopover('show') + }) + .bootstrapPopover('hide') + }) + .bootstrapPopover('show') + }) }) -- cgit v1.2.3 From 32cb0715949e5ab20716121234d858e51f3ff386 Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Mon, 29 Dec 2014 18:34:35 -0800 Subject: Remove semicolons from #15425 because fat --- js/tests/unit/popover.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'js') diff --git a/js/tests/unit/popover.js b/js/tests/unit/popover.js index 4b8b2a96b..13ba93862 100644 --- a/js/tests/unit/popover.js +++ b/js/tests/unit/popover.js @@ -221,10 +221,10 @@ $(function () { test('should detach popover content rather than removing it so that event handlers are left intact', function () { var $content = $('').appendTo('#qunit-fixture') - var handlerCalled = false; + var handlerCalled = false $('.content-with-handler .btn').click(function () { handlerCalled = true - }); + }) var $div = $('
Show popover
') .appendTo('#qunit-fixture') @@ -233,7 +233,7 @@ $(function () { trigger: 'manual', container: 'body', content: function () { - return $content; + return $content } }) -- cgit v1.2.3 From adaabab81bcc7da1c832ecdab79db9d87f04e5b2 Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Mon, 29 Dec 2014 20:03:27 -0800 Subject: Revert "Allow multiple delegated tooltip selectors on a node" This reverts commit 1b3237629a316af41945e20837cf3a332798b264. This reverts PR #14189 because it caused major regressions. Fixes #15168. We'll try to revisit #14167's feature request in Bootstrap v4. [skip validator] --- js/popover.js | 14 ++++---------- js/tests/unit/popover.js | 30 ------------------------------ js/tests/unit/tooltip.js | 31 ------------------------------- js/tooltip.js | 14 ++++---------- 4 files changed, 8 insertions(+), 81 deletions(-) (limited to 'js') diff --git a/js/popover.js b/js/popover.js index db272bdee..3a0bab38b 100644 --- a/js/popover.js +++ b/js/popover.js @@ -86,18 +86,12 @@ function Plugin(option) { return this.each(function () { - var $this = $(this) - var data = $this.data('bs.popover') - var options = typeof option == 'object' && option - var selector = options && options.selector + var $this = $(this) + var data = $this.data('bs.popover') + var options = typeof option == 'object' && option if (!data && option == 'destroy') return - if (selector) { - if (!data) $this.data('bs.popover', (data = {})) - if (!data[selector]) data[selector] = new Popover(this, options) - } else { - if (!data) $this.data('bs.popover', (data = new Popover(this, options))) - } + if (!data) $this.data('bs.popover', (data = new Popover(this, options))) if (typeof option == 'string') data[option]() }) } diff --git a/js/tests/unit/popover.js b/js/tests/unit/popover.js index 13ba93862..e1a2edef7 100644 --- a/js/tests/unit/popover.js +++ b/js/tests/unit/popover.js @@ -188,36 +188,6 @@ $(function () { equal($('.popover').length, 0, 'popover was removed') }) - test('should render popover elements using different delegated selectors on the same node', function () { - var popoverHTML = '
' - + '@mdo' - + '@mdo' - + '
' - - var $div = $(popoverHTML) - .appendTo('#qunit-fixture') - .bootstrapPopover({ - selector: 'a.first', - trigger: 'click' - }) - .bootstrapPopover({ - selector: 'a.second', - trigger: 'click' - }) - - $div.find('a.first').click() - notEqual($('.popover').length, 0, 'first popover was inserted') - - $div.find('a.first').click() - equal($('.popover').length, 0, 'first popover removed') - - $div.find('a.second').click() - notEqual($('.popover').length, 0, 'second popover was inserted') - - $div.find('a.second').click() - equal($('.popover').length, 0, 'second popover removed') - }) - test('should detach popover content rather than removing it so that event handlers are left intact', function () { var $content = $('').appendTo('#qunit-fixture') diff --git a/js/tests/unit/tooltip.js b/js/tests/unit/tooltip.js index eb578c22a..2264ca372 100644 --- a/js/tests/unit/tooltip.js +++ b/js/tests/unit/tooltip.js @@ -235,37 +235,6 @@ $(function () { equal($('.tooltip').length, 0, 'tooltip was removed from dom') }) - test('should show tooltips with different delegate selectors on the same node on click', function () { - var tooltipHTML = '
' - + '' - + '' - + '
' - - var $div = $(tooltipHTML) - .append() - .appendTo('#qunit-fixture') - .bootstrapTooltip({ - selector: 'a.first[rel="tooltip"]', - trigger: 'click' - }) - .bootstrapTooltip({ - selector: 'a.second[rel="tooltip"]', - trigger: 'click' - }) - - $div.find('a.first').click() - ok($('.tooltip').is('.fade.in'), 'first tooltip is faded in') - - $div.find('a.first').click() - equal($('.tooltip').length, 0, 'first tooltip was removed from dom') - - $div.find('a.second').click() - ok($('.tooltip').is('.fade.in'), 'second tooltip is faded in') - - $div.find('a.second').click() - equal($('.tooltip').length, 0, 'second tooltip was removed from dom') - }) - test('should show tooltip when toggle is called', function () { $('') .appendTo('#qunit-fixture') diff --git a/js/tooltip.js b/js/tooltip.js index cda147d9c..a3bed9856 100644 --- a/js/tooltip.js +++ b/js/tooltip.js @@ -445,18 +445,12 @@ function Plugin(option) { return this.each(function () { - var $this = $(this) - var data = $this.data('bs.tooltip') - var options = typeof option == 'object' && option - var selector = options && options.selector + var $this = $(this) + var data = $this.data('bs.tooltip') + var options = typeof option == 'object' && option if (!data && option == 'destroy') return - if (selector) { - if (!data) $this.data('bs.tooltip', (data = {})) - if (!data[selector]) data[selector] = new Tooltip(this, options) - } else { - if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options))) - } + if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options))) if (typeof option == 'string') data[option]() }) } -- cgit v1.2.3 From 576230b92ae5a082eb8e058dc2fab7c67c99bd19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zlatan=20Vasovi=C4=87?= Date: Thu, 1 Jan 2015 01:23:48 +0100 Subject: Happy New Year :santa: --- js/affix.js | 2 +- js/alert.js | 2 +- js/button.js | 2 +- js/carousel.js | 2 +- js/collapse.js | 2 +- js/dropdown.js | 2 +- js/modal.js | 2 +- js/popover.js | 2 +- js/scrollspy.js | 2 +- js/tab.js | 2 +- js/tooltip.js | 2 +- js/transition.js | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) (limited to 'js') diff --git a/js/affix.js b/js/affix.js index 04f389e2c..1f067342c 100644 --- a/js/affix.js +++ b/js/affix.js @@ -2,7 +2,7 @@ * Bootstrap: affix.js v3.3.1 * http://getbootstrap.com/javascript/#affix * ======================================================================== - * Copyright 2011-2014 Twitter, Inc. + * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ diff --git a/js/alert.js b/js/alert.js index 7b775dd0a..1ba3a44e1 100644 --- a/js/alert.js +++ b/js/alert.js @@ -2,7 +2,7 @@ * Bootstrap: alert.js v3.3.1 * http://getbootstrap.com/javascript/#alerts * ======================================================================== - * Copyright 2011-2014 Twitter, Inc. + * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ diff --git a/js/button.js b/js/button.js index 7b1e134b2..2d71f350b 100644 --- a/js/button.js +++ b/js/button.js @@ -2,7 +2,7 @@ * Bootstrap: button.js v3.3.1 * http://getbootstrap.com/javascript/#buttons * ======================================================================== - * Copyright 2011-2014 Twitter, Inc. + * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ diff --git a/js/carousel.js b/js/carousel.js index 99a077c10..468a78d59 100644 --- a/js/carousel.js +++ b/js/carousel.js @@ -2,7 +2,7 @@ * Bootstrap: carousel.js v3.3.1 * http://getbootstrap.com/javascript/#carousel * ======================================================================== - * Copyright 2011-2014 Twitter, Inc. + * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ diff --git a/js/collapse.js b/js/collapse.js index a2ede5914..8ffa1e708 100644 --- a/js/collapse.js +++ b/js/collapse.js @@ -2,7 +2,7 @@ * Bootstrap: collapse.js v3.3.1 * http://getbootstrap.com/javascript/#collapse * ======================================================================== - * Copyright 2011-2014 Twitter, Inc. + * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ diff --git a/js/dropdown.js b/js/dropdown.js index 69a40f681..980424d63 100644 --- a/js/dropdown.js +++ b/js/dropdown.js @@ -2,7 +2,7 @@ * Bootstrap: dropdown.js v3.3.1 * http://getbootstrap.com/javascript/#dropdowns * ======================================================================== - * Copyright 2011-2014 Twitter, Inc. + * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ diff --git a/js/modal.js b/js/modal.js index 93891aa4e..6be32fcd8 100644 --- a/js/modal.js +++ b/js/modal.js @@ -2,7 +2,7 @@ * Bootstrap: modal.js v3.3.1 * http://getbootstrap.com/javascript/#modals * ======================================================================== - * Copyright 2011-2014 Twitter, Inc. + * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ diff --git a/js/popover.js b/js/popover.js index 3a0bab38b..034d6efd9 100644 --- a/js/popover.js +++ b/js/popover.js @@ -2,7 +2,7 @@ * Bootstrap: popover.js v3.3.1 * http://getbootstrap.com/javascript/#popovers * ======================================================================== - * Copyright 2011-2014 Twitter, Inc. + * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ diff --git a/js/scrollspy.js b/js/scrollspy.js index c468262f3..20a3e4060 100644 --- a/js/scrollspy.js +++ b/js/scrollspy.js @@ -2,7 +2,7 @@ * Bootstrap: scrollspy.js v3.3.1 * http://getbootstrap.com/javascript/#scrollspy * ======================================================================== - * Copyright 2011-2014 Twitter, Inc. + * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ diff --git a/js/tab.js b/js/tab.js index d59827f2e..01f233634 100644 --- a/js/tab.js +++ b/js/tab.js @@ -2,7 +2,7 @@ * Bootstrap: tab.js v3.3.1 * http://getbootstrap.com/javascript/#tabs * ======================================================================== - * Copyright 2011-2014 Twitter, Inc. + * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ diff --git a/js/tooltip.js b/js/tooltip.js index a3bed9856..a1140d247 100644 --- a/js/tooltip.js +++ b/js/tooltip.js @@ -3,7 +3,7 @@ * http://getbootstrap.com/javascript/#tooltip * Inspired by the original jQuery.tipsy by Jason Frame * ======================================================================== - * Copyright 2011-2014 Twitter, Inc. + * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ diff --git a/js/transition.js b/js/transition.js index 68c2bd60b..1853b5f2e 100644 --- a/js/transition.js +++ b/js/transition.js @@ -2,7 +2,7 @@ * Bootstrap: transition.js v3.3.1 * http://getbootstrap.com/javascript/#transitions * ======================================================================== - * Copyright 2011-2014 Twitter, Inc. + * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ -- cgit v1.2.3