From 22f9767714a9f80d5d12479725e8875bdd83f341 Mon Sep 17 00:00:00 2001 From: fat Date: Wed, 18 Dec 2013 21:14:01 -0800 Subject: =?UTF-8?q?check=20that=20href=20id's=20are=20followed=20by=20vali?= =?UTF-8?q?d=20char=20=E2=80=93=20fixes=20#10044?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/dropdown.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/dropdown.js b/js/dropdown.js index e7682ffb5..1788b0195 100644 --- a/js/dropdown.js +++ b/js/dropdown.js @@ -95,7 +95,7 @@ if (!selector) { selector = $this.attr('href') - selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 + selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 } var $parent = selector && $(selector) -- cgit v1.2.3 From 1bf5abab3153159d09f83f5512735da2144394d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zlatan=20Vasovi=C4=87?= Date: Thu, 19 Dec 2013 15:32:37 +0100 Subject: No leading pluses --- js/scrollspy.js | 8 +- js/tests/unit/alert.js | 16 ++-- js/tests/unit/dropdown.js | 187 ++++++++++++++++++++++----------------------- js/tests/unit/scrollspy.js | 19 +++-- js/tests/unit/tab.js | 35 ++++----- 5 files changed, 130 insertions(+), 135 deletions(-) (limited to 'js') diff --git a/js/scrollspy.js b/js/scrollspy.js index b41c27413..3393572b7 100644 --- a/js/scrollspy.js +++ b/js/scrollspy.js @@ -88,15 +88,15 @@ .parents('.active') .removeClass('active') - var selector = this.selector - + '[data-target="' + target + '"],' - + this.selector + '[href="' + target + '"]' + var selector = this.selector + + '[data-target="' + target + '"],' + + this.selector + '[href="' + target + '"]' var active = $(selector) .parents('li') .addClass('active') - if (active.parent('.dropdown-menu').length) { + if (active.parent('.dropdown-menu').length) { active = active .closest('li.dropdown') .addClass('active') diff --git a/js/tests/unit/alert.js b/js/tests/unit/alert.js index 3fe2e70a3..b88b95fee 100644 --- a/js/tests/unit/alert.js +++ b/js/tests/unit/alert.js @@ -17,10 +17,10 @@ $(function () { }) test('should fade element out on clicking .close', function () { - var alertHTML = '
' - + '×' - + '

Holy guacamole! Best check yo self, you\'re not looking too good.

' - + '
', + var alertHTML = '
' + + '×' + + '

Holy guacamole! Best check yo self, you\'re not looking too good.

' + + '
', alert = $(alertHTML).alert() alert.find('.close').click() @@ -31,10 +31,10 @@ $(function () { test('should remove element when clicking .close', function () { $.support.transition = false - var alertHTML = '
' - + '×' - + '

Holy guacamole! Best check yo self, you\'re not looking too good.

' - + '
', + var alertHTML = '
' + + '×' + + '

Holy guacamole! Best check yo self, you\'re not looking too good.

' + + '
', alert = $(alertHTML).appendTo('#qunit-fixture').alert() ok($('#qunit-fixture').find('.alert-message').length, 'element added to dom') diff --git a/js/tests/unit/dropdown.js b/js/tests/unit/dropdown.js index 34e11de1c..b358b7387 100644 --- a/js/tests/unit/dropdown.js +++ b/js/tests/unit/dropdown.js @@ -18,68 +18,68 @@ $(function () { }) test('should not open dropdown if target is disabled', function () { - var dropdownHTML = '', + var dropdownHTML = '', dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click() ok(!dropdown.parent('.dropdown').hasClass('open'), 'open class added on click') }) test('should not open dropdown if target is disabled', function () { - var dropdownHTML = '', + var dropdownHTML = '', dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click() ok(!dropdown.parent('.dropdown').hasClass('open'), 'open class added on click') }) test('should add class open to menu if clicked', function () { - var dropdownHTML = '', + var dropdownHTML = '', dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click() ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click') }) test('should test if element has a # before assuming it\'s a selector', function () { - var dropdownHTML = '', + var dropdownHTML = '', dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click() ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click') @@ -87,17 +87,17 @@ $(function () { test('should remove open class if body clicked', function () { - var dropdownHTML = '', + var dropdownHTML = '', dropdown = $(dropdownHTML) .appendTo('#qunit-fixture') .find('[data-toggle="dropdown"]') @@ -111,23 +111,22 @@ $(function () { }) test('should remove open class if body clicked, with multiple drop downs', function () { - var dropdownHTML = - '' - + '
' - + ' ' - + ' ' - + ' ' - + '
', + var dropdownHTML = '' + + '
' + + ' ' + + ' ' + + ' ' + + '
', dropdowns = $(dropdownHTML).appendTo('#qunit-fixture').find('[data-toggle="dropdown"]'), first = dropdowns.first(), last = dropdowns.last() @@ -150,17 +149,17 @@ $(function () { }) test('should fire show and hide event', function () { - var dropdownHTML = '', + var dropdownHTML = '', dropdown = $(dropdownHTML) .appendTo('#qunit-fixture') .find('[data-toggle="dropdown"]') @@ -184,17 +183,17 @@ $(function () { test('should fire shown and hiden event', function () { - var dropdownHTML = '', + var dropdownHTML = '', dropdown = $(dropdownHTML) .appendTo('#qunit-fixture') .find('[data-toggle="dropdown"]') diff --git a/js/tests/unit/scrollspy.js b/js/tests/unit/scrollspy.js index ffc3d9a46..cf7b50dc4 100644 --- a/js/tests/unit/scrollspy.js +++ b/js/tests/unit/scrollspy.js @@ -19,16 +19,15 @@ $(function () { test('should switch active class on scroll', function () { var sectionHTML = '
' $section = $(sectionHTML).append('#qunit-fixture'), - topbarHTML = '
' - + '
' - + '
' - + '

Bootstrap

' - + '' - + '
' - + '
' - + '
', + topbarHTML = '
' + + '
' + + '
' + + '

Bootstrap

' + + '
  • Overview
  • ' + + '' + + '
    ' + + '
    ' + + '
    ', $topbar = $(topbarHTML).scrollspy() ok($topbar.find('.active', true)) diff --git a/js/tests/unit/tab.js b/js/tests/unit/tab.js index 6da7dc9a4..59bedf391 100644 --- a/js/tests/unit/tab.js +++ b/js/tests/unit/tab.js @@ -17,11 +17,10 @@ $(function () { }) test('should activate element by tab id', function () { - var tabsHTML = - '' + var tabsHTML = '' $('').appendTo('#qunit-fixture') @@ -33,11 +32,10 @@ $(function () { }) test('should activate element by tab id', function () { - var pillsHTML = - '' + var pillsHTML = '' $('').appendTo('#qunit-fixture') @@ -65,15 +63,14 @@ $(function () { }) test('show and shown events should reference correct relatedTarget', function () { - var dropHTML = - '' + var dropHTML = '' $(dropHTML).find('ul>li:first a').tab('show').end() .find('ul>li:last a').on('show', function (event) { -- cgit v1.2.3