aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorXhmikosR <[email protected]>2015-04-26 13:53:45 +0300
committerXhmikosR <[email protected]>2015-04-28 11:03:37 +0300
commit3e7ca3bbc8eaa60013d4ab9f2edd42f6dcd8dd4b (patch)
tree968eee9693cf578b4f3f2991f4a482019cf4cf43 /js
parent4e027718a816f50e9d87acd890644b8f0ecce856 (diff)
downloadbootstrap-3e7ca3bbc8eaa60013d4ab9f2edd42f6dcd8dd4b.tar.xz
bootstrap-3e7ca3bbc8eaa60013d4ab9f2edd42f6dcd8dd4b.zip
Minor lint tweaks.
Diffstat (limited to 'js')
-rw-r--r--js/button.js2
-rw-r--r--js/dropdown.js76
-rw-r--r--js/tab.js2
-rw-r--r--js/tooltip.js6
4 files changed, 43 insertions, 43 deletions
diff --git a/js/button.js b/js/button.js
index 3b86f35d4..8716aff4f 100644
--- a/js/button.js
+++ b/js/button.js
@@ -31,7 +31,7 @@
var val = $el.is('input') ? 'val' : 'html'
var data = $el.data()
- state = state + 'Text'
+ state += 'Text'
if (data.resetText == null) $el.data('resetText', $el[val]())
diff --git a/js/dropdown.js b/js/dropdown.js
index 371e30756..8fd86a025 100644
--- a/js/dropdown.js
+++ b/js/dropdown.js
@@ -21,6 +21,40 @@
Dropdown.VERSION = '3.3.4'
+ function getParent($this) {
+ var selector = $this.attr('data-target')
+
+ if (!selector) {
+ selector = $this.attr('href')
+ selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
+ }
+
+ var $parent = selector && $(selector)
+
+ return $parent && $parent.length ? $parent : $this.parent()
+ }
+
+ function clearMenus(e) {
+ if (e && e.which === 3) return
+ $(backdrop).remove()
+ $(toggle).each(function () {
+ var $this = $(this)
+ var $parent = getParent($this)
+ var relatedTarget = { relatedTarget: this }
+
+ if (!$parent.hasClass('open')) return
+
+ if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return
+
+ $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
+
+ if (e.isDefaultPrevented()) return
+
+ $this.attr('aria-expanded', 'false')
+ $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
+ })
+ }
+
Dropdown.prototype.toggle = function (e) {
var $this = $(this)
@@ -70,7 +104,7 @@
var $parent = getParent($this)
var isActive = $parent.hasClass('open')
- if ((!isActive && e.which != 27) || (isActive && e.which == 27)) {
+ if (!isActive && e.which != 27 || isActive && e.which == 27) {
if (e.which == 27) $parent.find(toggle).trigger('focus')
return $this.trigger('click')
}
@@ -82,47 +116,13 @@
var index = $items.index(e.target)
- if (e.which == 38 && index > 0) index-- // up
- if (e.which == 40 && index < $items.length - 1) index++ // down
- if (!~index) index = 0
+ if (e.which == 38 && index > 0) index-- // up
+ if (e.which == 40 && index < $items.length - 1) index++ // down
+ if (!~index) index = 0
$items.eq(index).trigger('focus')
}
- function clearMenus(e) {
- if (e && e.which === 3) return
- $(backdrop).remove()
- $(toggle).each(function () {
- var $this = $(this)
- var $parent = getParent($this)
- var relatedTarget = { relatedTarget: this }
-
- if (!$parent.hasClass('open')) return
-
- if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return
-
- $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
-
- if (e.isDefaultPrevented()) return
-
- $this.attr('aria-expanded', 'false')
- $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
- })
- }
-
- function getParent($this) {
- var selector = $this.attr('data-target')
-
- if (!selector) {
- selector = $this.attr('href')
- selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
- }
-
- var $parent = selector && $(selector)
-
- return $parent && $parent.length ? $parent : $this.parent()
- }
-
// DROPDOWN PLUGIN DEFINITION
// ==========================
diff --git a/js/tab.js b/js/tab.js
index 935d5bc80..685bbc91f 100644
--- a/js/tab.js
+++ b/js/tab.js
@@ -65,7 +65,7 @@
var $active = container.find('> .active')
var transition = callback
&& $.support.transition
- && (($active.length && $active.hasClass('fade')) || !!container.find('> .fade').length)
+ && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)
function next() {
$active
diff --git a/js/tooltip.js b/js/tooltip.js
index f48dcfb70..af1483aba 100644
--- a/js/tooltip.js
+++ b/js/tooltip.js
@@ -239,8 +239,8 @@
if (isNaN(marginTop)) marginTop = 0
if (isNaN(marginLeft)) marginLeft = 0
- offset.top = offset.top + marginTop
- offset.left = offset.left + marginLeft
+ offset.top += marginTop
+ offset.left += marginLeft
// $.fn.offset doesn't round pixel values
// so we use setOffset directly with our own function B-0
@@ -322,7 +322,7 @@
Tooltip.prototype.fixTitle = function () {
var $e = this.$element
- if ($e.attr('title') || typeof ($e.attr('data-original-title')) != 'string') {
+ if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {
$e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
}
}