anjlab-bootstrap-rails 2.3.1.2 → 3.0.0.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/.gitmodules +3 -0
  3. data/Rakefile +42 -26
  4. data/lib/bootstrap-rails.rb +5 -6
  5. data/lib/bootstrap-rails/engine.rb +2 -9
  6. data/lib/bootstrap-rails/version.rb +1 -1
  7. data/test/test_helper.rb +2 -2
  8. data/vendor/assets/fonts/twitter/glyphiconshalflings-regular.eot +0 -0
  9. data/vendor/assets/fonts/twitter/glyphiconshalflings-regular.otf +0 -0
  10. data/vendor/assets/fonts/twitter/glyphiconshalflings-regular.svg +175 -0
  11. data/vendor/assets/fonts/twitter/glyphiconshalflings-regular.ttf +0 -0
  12. data/vendor/assets/fonts/twitter/glyphiconshalflings-regular.woff +0 -0
  13. data/vendor/assets/javascripts/twitter/bootstrap.js +4 -5
  14. data/vendor/assets/javascripts/twitter/bootstrap/affix.js +50 -47
  15. data/vendor/assets/javascripts/twitter/bootstrap/alert.js +32 -35
  16. data/vendor/assets/javascripts/twitter/bootstrap/button.js +37 -37
  17. data/vendor/assets/javascripts/twitter/bootstrap/carousel.js +123 -127
  18. data/vendor/assets/javascripts/twitter/bootstrap/collapse.js +81 -95
  19. data/vendor/assets/javascripts/twitter/bootstrap/dropdown.js +61 -81
  20. data/vendor/assets/javascripts/twitter/bootstrap/modal.js +146 -151
  21. data/vendor/assets/javascripts/twitter/bootstrap/popover.js +53 -58
  22. data/vendor/assets/javascripts/twitter/bootstrap/scrollspy.js +99 -105
  23. data/vendor/assets/javascripts/twitter/bootstrap/tab.js +70 -81
  24. data/vendor/assets/javascripts/twitter/bootstrap/tooltip.js +246 -254
  25. data/vendor/assets/javascripts/twitter/bootstrap/transition.js +24 -37
  26. data/vendor/assets/stylesheets/twitter/bootstrap.scss +1 -1
  27. data/vendor/{frameworks/twitter/bootstrap/accordion.scss → assets/stylesheets/twitter/bootstrap/_accordion.scss} +2 -2
  28. data/vendor/assets/stylesheets/twitter/bootstrap/_alerts.scss +92 -0
  29. data/vendor/assets/stylesheets/twitter/bootstrap/_badges.scss +58 -0
  30. data/vendor/assets/stylesheets/twitter/bootstrap/_bootstrap.scss +64 -0
  31. data/vendor/assets/stylesheets/twitter/bootstrap/_breadcrumbs.scss +28 -0
  32. data/vendor/assets/stylesheets/twitter/bootstrap/_button-groups.scss +170 -0
  33. data/vendor/assets/stylesheets/twitter/bootstrap/_buttons.scss +160 -0
  34. data/vendor/assets/stylesheets/twitter/bootstrap/_carousel.scss +191 -0
  35. data/vendor/{frameworks/twitter/bootstrap/close.scss → assets/stylesheets/twitter/bootstrap/_close.scss} +7 -6
  36. data/vendor/{frameworks/twitter/bootstrap/code.scss → assets/stylesheets/twitter/bootstrap/_code.scss} +14 -14
  37. data/vendor/{frameworks/twitter/bootstrap/component-animations.scss → assets/stylesheets/twitter/bootstrap/_component-animations.scss} +1 -0
  38. data/vendor/{frameworks/twitter/bootstrap/dropdowns.scss → assets/stylesheets/twitter/bootstrap/_dropdowns.scss} +46 -57
  39. data/vendor/assets/stylesheets/twitter/bootstrap/_forms.scss +464 -0
  40. data/vendor/assets/stylesheets/twitter/bootstrap/_glyphicons.scss +200 -0
  41. data/vendor/assets/stylesheets/twitter/bootstrap/_grid.scss +65 -0
  42. data/vendor/assets/stylesheets/twitter/bootstrap/_jumbotron.scss +32 -0
  43. data/vendor/assets/stylesheets/twitter/bootstrap/_labels.scss +70 -0
  44. data/vendor/assets/stylesheets/twitter/bootstrap/_list-group.scss +96 -0
  45. data/vendor/{frameworks/twitter/bootstrap/media.scss → assets/stylesheets/twitter/bootstrap/_media.scss} +0 -1
  46. data/vendor/assets/stylesheets/twitter/bootstrap/_mixins.scss +510 -0
  47. data/vendor/assets/stylesheets/twitter/bootstrap/_modals.scss +137 -0
  48. data/vendor/assets/stylesheets/twitter/bootstrap/_navbar.scss +356 -0
  49. data/vendor/assets/stylesheets/twitter/bootstrap/_navs.scss +249 -0
  50. data/vendor/assets/stylesheets/twitter/bootstrap/_normalize.scss +396 -0
  51. data/vendor/assets/stylesheets/twitter/bootstrap/_pager.scss +54 -0
  52. data/vendor/assets/stylesheets/twitter/bootstrap/_pagination.scss +87 -0
  53. data/vendor/assets/stylesheets/twitter/bootstrap/_panels.scss +96 -0
  54. data/vendor/{frameworks/twitter/bootstrap/popovers.scss → assets/stylesheets/twitter/bootstrap/_popovers.scss} +32 -32
  55. data/vendor/assets/stylesheets/twitter/bootstrap/_print.scss +74 -0
  56. data/vendor/{frameworks/twitter/bootstrap/progress-bars.scss → assets/stylesheets/twitter/bootstrap/_progress-bars.scss} +40 -44
  57. data/vendor/assets/stylesheets/twitter/bootstrap/_responsive-utilities.scss +77 -0
  58. data/vendor/assets/stylesheets/twitter/bootstrap/_scaffolding.scss +83 -0
  59. data/vendor/assets/stylesheets/twitter/bootstrap/_tables.scss +242 -0
  60. data/vendor/assets/stylesheets/twitter/bootstrap/_thumbnails.scss +43 -0
  61. data/vendor/{frameworks/twitter/bootstrap/tooltip.scss → assets/stylesheets/twitter/bootstrap/_tooltip.scss} +20 -19
  62. data/vendor/assets/stylesheets/twitter/bootstrap/_type.scss +253 -0
  63. data/vendor/{frameworks/twitter/bootstrap/utilities.scss → assets/stylesheets/twitter/bootstrap/_utilities.scss} +17 -5
  64. data/vendor/assets/stylesheets/twitter/bootstrap/_variables.scss +416 -0
  65. data/vendor/{frameworks/twitter/bootstrap/wells.scss → assets/stylesheets/twitter/bootstrap/_wells.scss} +5 -5
  66. metadata +49 -53
  67. data/lib/bootstrap-rails/ie_hex_str.rb +0 -16
  68. data/test/ie_hex_str_test.rb +0 -26
  69. data/vendor/assets/images/twitter/glyphicons-halflings-white.png +0 -0
  70. data/vendor/assets/images/twitter/glyphicons-halflings.png +0 -0
  71. data/vendor/assets/javascripts/twitter/bootstrap/typeahead.js +0 -335
  72. data/vendor/assets/stylesheets/twitter/bootstrap-responsive.scss +0 -1
  73. data/vendor/frameworks/twitter/bootstrap.scss +0 -1
  74. data/vendor/frameworks/twitter/bootstrap/alerts.scss +0 -79
  75. data/vendor/frameworks/twitter/bootstrap/bootstrap.scss +0 -63
  76. data/vendor/frameworks/twitter/bootstrap/breadcrumbs.scss +0 -24
  77. data/vendor/frameworks/twitter/bootstrap/button-groups.scss +0 -230
  78. data/vendor/frameworks/twitter/bootstrap/buttons.scss +0 -228
  79. data/vendor/frameworks/twitter/bootstrap/carousel.scss +0 -158
  80. data/vendor/frameworks/twitter/bootstrap/forms.scss +0 -690
  81. data/vendor/frameworks/twitter/bootstrap/grid.scss +0 -21
  82. data/vendor/frameworks/twitter/bootstrap/hero-unit.scss +0 -25
  83. data/vendor/frameworks/twitter/bootstrap/labels-badges.scss +0 -83
  84. data/vendor/frameworks/twitter/bootstrap/layouts.scss +0 -16
  85. data/vendor/frameworks/twitter/bootstrap/mixins.scss +0 -704
  86. data/vendor/frameworks/twitter/bootstrap/modals.scss +0 -95
  87. data/vendor/frameworks/twitter/bootstrap/navbar.scss +0 -496
  88. data/vendor/frameworks/twitter/bootstrap/navs.scss +0 -409
  89. data/vendor/frameworks/twitter/bootstrap/pager.scss +0 -43
  90. data/vendor/frameworks/twitter/bootstrap/pagination.scss +0 -123
  91. data/vendor/frameworks/twitter/bootstrap/reset.scss +0 -216
  92. data/vendor/frameworks/twitter/bootstrap/responsive-1200px-min.scss +0 -28
  93. data/vendor/frameworks/twitter/bootstrap/responsive-767px-max.scss +0 -189
  94. data/vendor/frameworks/twitter/bootstrap/responsive-768px-979px.scss +0 -19
  95. data/vendor/frameworks/twitter/bootstrap/responsive-navbar.scss +0 -189
  96. data/vendor/frameworks/twitter/bootstrap/responsive-utilities.scss +0 -59
  97. data/vendor/frameworks/twitter/bootstrap/responsive.scss +0 -48
  98. data/vendor/frameworks/twitter/bootstrap/scaffolding.scss +0 -53
  99. data/vendor/frameworks/twitter/bootstrap/sprites.scss +0 -197
  100. data/vendor/frameworks/twitter/bootstrap/tables.scss +0 -235
  101. data/vendor/frameworks/twitter/bootstrap/thumbnails.scss +0 -53
  102. data/vendor/frameworks/twitter/bootstrap/type.scss +0 -246
  103. data/vendor/frameworks/twitter/bootstrap/variables.scss +0 -295
@@ -1,7 +1,7 @@
1
- /* =============================================================
2
- * bootstrap-collapse.js v2.3.1
1
+ /* ========================================================================
2
+ * Bootstrap: collapse.js v3.0.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#collapse
4
- * =============================================================
4
+ * ========================================================================
5
5
  * Copyright 2012 Twitter, Inc.
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,135 +15,120 @@
15
15
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
16
  * See the License for the specific language governing permissions and
17
17
  * limitations under the License.
18
- * ============================================================ */
18
+ * ======================================================================== */
19
19
 
20
20
 
21
- !function ($) {
21
+ +function ($) { "use strict";
22
22
 
23
- "use strict"; // jshint ;_;
24
-
25
-
26
- /* COLLAPSE PUBLIC CLASS DEFINITION
27
- * ================================ */
23
+ // COLLAPSE PUBLIC CLASS DEFINITION
24
+ // ================================
28
25
 
29
26
  var Collapse = function (element, options) {
30
- this.$element = $(element)
31
- this.options = $.extend({}, $.fn.collapse.defaults, options)
27
+ this.$element = $(element)
28
+ this.options = $.extend({}, Collapse.DEFAULTS, options)
29
+ this.transitioning = null
32
30
 
33
- if (this.options.parent) {
34
- this.$parent = $(this.options.parent)
35
- }
31
+ if (this.options.parent) this.$parent = $(this.options.parent)
32
+ if (this.options.toggle) this.toggle()
33
+ }
36
34
 
37
- this.options.toggle && this.toggle()
35
+ Collapse.DEFAULTS = {
36
+ toggle: true
38
37
  }
39
38
 
40
- Collapse.prototype = {
39
+ Collapse.prototype.dimension = function () {
40
+ var hasWidth = this.$element.hasClass('width')
41
+ return hasWidth ? 'width' : 'height'
42
+ }
41
43
 
42
- constructor: Collapse
44
+ Collapse.prototype.show = function () {
45
+ if (this.transitioning || this.$element.hasClass('in')) return
43
46
 
44
- , dimension: function () {
45
- var hasWidth = this.$element.hasClass('width')
46
- return hasWidth ? 'width' : 'height'
47
- }
47
+ var dimension = this.dimension()
48
+ var scroll = $.camelCase(['scroll', dimension].join('-'))
49
+ var actives = this.$parent && this.$parent.find('> .accordion-group > .in')
48
50
 
49
- , show: function () {
50
- var dimension
51
- , scroll
52
- , actives
53
- , hasData
54
-
55
- if (this.transitioning || this.$element.hasClass('in')) return
51
+ if (actives && actives.length) {
52
+ var hasData = actives.data('collapse')
53
+ if (hasData && hasData.transitioning) return
54
+ actives.collapse('hide')
55
+ hasData || actives.data('collapse', null)
56
+ }
56
57
 
57
- dimension = this.dimension()
58
- scroll = $.camelCase(['scroll', dimension].join('-'))
59
- actives = this.$parent && this.$parent.find('> .accordion-group > .in')
58
+ this.$element[dimension](0)
59
+ this.transition('addClass', $.Event('show.bs.collapse'), 'shown.bs.collapse')
60
60
 
61
- if (actives && actives.length) {
62
- hasData = actives.data('collapse')
63
- if (hasData && hasData.transitioning) return
64
- actives.collapse('hide')
65
- hasData || actives.data('collapse', null)
66
- }
61
+ if ($.support.transition) this.$element[dimension](this.$element[0][scroll])
62
+ }
67
63
 
68
- this.$element[dimension](0)
69
- this.transition('addClass', $.Event('show'), 'shown')
70
- $.support.transition && this.$element[dimension](this.$element[0][scroll])
71
- }
64
+ Collapse.prototype.hide = function () {
65
+ if (this.transitioning || !this.$element.hasClass('in')) return
66
+ var dimension = this.dimension()
67
+ this.reset(this.$element[dimension]())
68
+ this.transition('removeClass', $.Event('hide.bs.collapse'), 'hidden')
69
+ this.$element[dimension](0)
70
+ }
72
71
 
73
- , hide: function () {
74
- var dimension
75
- if (this.transitioning || !this.$element.hasClass('in')) return
76
- dimension = this.dimension()
77
- this.reset(this.$element[dimension]())
78
- this.transition('removeClass', $.Event('hide'), 'hidden')
79
- this.$element[dimension](0)
80
- }
72
+ Collapse.prototype.reset = function (size) {
73
+ var dimension = this.dimension()
81
74
 
82
- , reset: function (size) {
83
- var dimension = this.dimension()
75
+ this.$element
76
+ .removeClass('collapse')
77
+ [dimension](size || 'auto')
78
+ [0].offsetWidth
84
79
 
85
- this.$element
86
- .removeClass('collapse')
87
- [dimension](size || 'auto')
88
- [0].offsetWidth
80
+ this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
89
81
 
90
- this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
82
+ return this
83
+ }
91
84
 
92
- return this
85
+ Collapse.prototype.transition = function (method, startEvent, completeEvent) {
86
+ var that = this
87
+ var complete = function () {
88
+ if (startEvent.type == 'show') that.reset()
89
+ that.transitioning = 0
90
+ that.$element.trigger(completeEvent)
93
91
  }
94
92
 
95
- , transition: function (method, startEvent, completeEvent) {
96
- var that = this
97
- , complete = function () {
98
- if (startEvent.type == 'show') that.reset()
99
- that.transitioning = 0
100
- that.$element.trigger(completeEvent)
101
- }
102
-
103
- this.$element.trigger(startEvent)
93
+ this.$element.trigger(startEvent)
104
94
 
105
- if (startEvent.isDefaultPrevented()) return
95
+ if (startEvent.isDefaultPrevented()) return
106
96
 
107
- this.transitioning = 1
97
+ this.transitioning = 1
108
98
 
109
- this.$element[method]('in')
99
+ this.$element[method]('in')
110
100
 
111
- $.support.transition && this.$element.hasClass('collapse') ?
112
- this.$element.one($.support.transition.end, complete) :
113
- complete()
114
- }
115
-
116
- , toggle: function () {
117
- this[this.$element.hasClass('in') ? 'hide' : 'show']()
118
- }
101
+ $.support.transition && this.$element.hasClass('collapse') ?
102
+ this.$element.one($.support.transition.end, complete) :
103
+ complete()
104
+ }
119
105
 
106
+ Collapse.prototype.toggle = function () {
107
+ this[this.$element.hasClass('in') ? 'hide' : 'show']()
120
108
  }
121
109
 
122
110
 
123
- /* COLLAPSE PLUGIN DEFINITION
124
- * ========================== */
111
+ // COLLAPSE PLUGIN DEFINITION
112
+ // ==========================
125
113
 
126
114
  var old = $.fn.collapse
127
115
 
128
116
  $.fn.collapse = function (option) {
129
117
  return this.each(function () {
130
- var $this = $(this)
131
- , data = $this.data('collapse')
132
- , options = $.extend({}, $.fn.collapse.defaults, $this.data(), typeof option == 'object' && option)
118
+ var $this = $(this)
119
+ var data = $this.data('collapse')
120
+ var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
121
+
133
122
  if (!data) $this.data('collapse', (data = new Collapse(this, options)))
134
123
  if (typeof option == 'string') data[option]()
135
124
  })
136
125
  }
137
126
 
138
- $.fn.collapse.defaults = {
139
- toggle: true
140
- }
141
-
142
127
  $.fn.collapse.Constructor = Collapse
143
128
 
144
129
 
145
- /* COLLAPSE NO CONFLICT
146
- * ==================== */
130
+ // COLLAPSE NO CONFLICT
131
+ // ====================
147
132
 
148
133
  $.fn.collapse.noConflict = function () {
149
134
  $.fn.collapse = old
@@ -151,17 +136,18 @@
151
136
  }
152
137
 
153
138
 
154
- /* COLLAPSE DATA-API
155
- * ================= */
139
+ // COLLAPSE DATA-API
140
+ // =================
156
141
 
157
142
  $(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
158
- var $this = $(this), href
159
- , target = $this.attr('data-target')
143
+ var $this = $(this), href
144
+ var target = $this.attr('data-target')
160
145
  || e.preventDefault()
161
146
  || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
162
- , option = $(target).data('collapse') ? 'toggle' : $this.data()
147
+ var option = $(target).data('collapse') ? 'toggle' : $this.data()
148
+
163
149
  $this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
164
150
  $(target).collapse(option)
165
151
  })
166
152
 
167
- }(window.jQuery);
153
+ }(window.jQuery);
@@ -1,7 +1,7 @@
1
- /* ============================================================
2
- * bootstrap-dropdown.js v2.3.1
1
+ /* ========================================================================
2
+ * Bootstrap: dropdown.js v3.0.0
3
3
  * http://twitter.github.com/bootstrap/javascript.html#dropdowns
4
- * ============================================================
4
+ * ========================================================================
5
5
  * Copyright 2012 Twitter, Inc.
6
6
  *
7
7
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,126 +15,106 @@
15
15
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
16
  * See the License for the specific language governing permissions and
17
17
  * limitations under the License.
18
- * ============================================================ */
18
+ * ======================================================================== */
19
19
 
20
20
 
21
- !function ($) {
21
+ +function ($) { "use strict";
22
22
 
23
- "use strict"; // jshint ;_;
23
+ // DROPDOWN CLASS DEFINITION
24
+ // =========================
24
25
 
26
+ var backdrop = '.dropdown-backdrop'
27
+ var toggle = '[data-toggle=dropdown]'
28
+ var Dropdown = function (element) {
29
+ var $el = $(element).on('click.dropdown.data-api', this.toggle)
30
+ $('html').on('click.dropdown.data-api', function () {
31
+ $el.parent().removeClass('open')
32
+ })
33
+ }
25
34
 
26
- /* DROPDOWN CLASS DEFINITION
27
- * ========================= */
28
-
29
- var toggle = '[data-toggle=dropdown]'
30
- , Dropdown = function (element) {
31
- var $el = $(element).on('click.dropdown.data-api', this.toggle)
32
- $('html').on('click.dropdown.data-api', function () {
33
- $el.parent().removeClass('open')
34
- })
35
- }
36
-
37
- Dropdown.prototype = {
38
-
39
- constructor: Dropdown
40
-
41
- , toggle: function (e) {
42
- var $this = $(this)
43
- , $parent
44
- , isActive
45
-
46
- if ($this.is('.disabled, :disabled')) return
35
+ Dropdown.prototype.toggle = function (e) {
36
+ var $this = $(this)
47
37
 
48
- $parent = getParent($this)
38
+ if ($this.is('.disabled, :disabled')) return
49
39
 
50
- isActive = $parent.hasClass('open')
40
+ var $parent = getParent($this)
41
+ var isActive = $parent.hasClass('open')
51
42
 
52
- clearMenus()
43
+ clearMenus()
53
44
 
54
- if (!isActive) {
55
- $parent.toggleClass('open')
45
+ if (!isActive) {
46
+ if ('ontouchstart' in document.documentElement) {
47
+ // if mobile we we use a backdrop because click events don't delegate
48
+ $('<div class="dropdown-backdrop"/>').insertBefore($(this)).on('click', clearMenus)
56
49
  }
57
-
58
- $this.focus()
59
-
60
- return false
50
+ $parent.toggleClass('open')
61
51
  }
62
52
 
63
- , keydown: function (e) {
64
- var $this
65
- , $items
66
- , $active
67
- , $parent
68
- , isActive
69
- , index
53
+ $this.focus()
70
54
 
71
- if (!/(38|40|27)/.test(e.keyCode)) return
55
+ return false
56
+ }
72
57
 
73
- $this = $(this)
58
+ Dropdown.prototype.keydown = function (e) {
59
+ if (!/(38|40|27)/.test(e.keyCode)) return
74
60
 
75
- e.preventDefault()
76
- e.stopPropagation()
61
+ var $this = $(this)
77
62
 
78
- if ($this.is('.disabled, :disabled')) return
63
+ e.preventDefault()
64
+ e.stopPropagation()
79
65
 
80
- $parent = getParent($this)
66
+ if ($this.is('.disabled, :disabled')) return
81
67
 
82
- isActive = $parent.hasClass('open')
68
+ var $parent = getParent($this)
69
+ var isActive = $parent.hasClass('open')
83
70
 
84
- if (!isActive || (isActive && e.keyCode == 27)) {
85
- if (e.which == 27) $parent.find(toggle).focus()
86
- return $this.click()
87
- }
88
-
89
- $items = $('[role=menu] li:not(.divider):visible a', $parent)
71
+ if (!isActive || (isActive && e.keyCode == 27)) {
72
+ if (e.which == 27) $parent.find(toggle).focus()
73
+ return $this.click()
74
+ }
90
75
 
91
- if (!$items.length) return
76
+ var $items = $('[role=menu] li:not(.divider):visible a', $parent)
92
77
 
93
- index = $items.index($items.filter(':focus'))
78
+ if (!$items.length) return
94
79
 
95
- if (e.keyCode == 38 && index > 0) index-- // up
96
- if (e.keyCode == 40 && index < $items.length - 1) index++ // down
97
- if (!~index) index = 0
80
+ var index = $items.index($items.filter(':focus'))
98
81
 
99
- $items
100
- .eq(index)
101
- .focus()
102
- }
82
+ if (e.keyCode == 38 && index > 0) index-- // up
83
+ if (e.keyCode == 40 && index < $items.length - 1) index++ // down
84
+ if (!~index) index=0
103
85
 
86
+ $items.eq(index).focus()
104
87
  }
105
88
 
106
89
  function clearMenus() {
107
- $(toggle).each(function () {
108
- getParent($(this)).removeClass('open')
109
- })
90
+ $(backdrop).remove()
91
+ $(toggle).each(function () { getParent($(this)).removeClass('open') })
110
92
  }
111
93
 
112
94
  function getParent($this) {
113
95
  var selector = $this.attr('data-target')
114
- , $parent
115
96
 
116
97
  if (!selector) {
117
98
  selector = $this.attr('href')
118
99
  selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
119
100
  }
120
101
 
121
- $parent = selector && $(selector)
122
-
123
- if (!$parent || !$parent.length) $parent = $this.parent()
102
+ var $parent = selector && $(selector)
124
103
 
125
- return $parent
104
+ return $parent && $parent.length ? $parent : $this.parent()
126
105
  }
127
106
 
128
107
 
129
- /* DROPDOWN PLUGIN DEFINITION
130
- * ========================== */
108
+ // DROPDOWN PLUGIN DEFINITION
109
+ // ==========================
131
110
 
132
111
  var old = $.fn.dropdown
133
112
 
134
113
  $.fn.dropdown = function (option) {
135
114
  return this.each(function () {
136
115
  var $this = $(this)
137
- , data = $this.data('dropdown')
116
+ var data = $this.data('dropdown')
117
+
138
118
  if (!data) $this.data('dropdown', (data = new Dropdown(this)))
139
119
  if (typeof option == 'string') data[option].call($this)
140
120
  })
@@ -143,8 +123,8 @@
143
123
  $.fn.dropdown.Constructor = Dropdown
144
124
 
145
125
 
146
- /* DROPDOWN NO CONFLICT
147
- * ==================== */
126
+ // DROPDOWN NO CONFLICT
127
+ // ====================
148
128
 
149
129
  $.fn.dropdown.noConflict = function () {
150
130
  $.fn.dropdown = old
@@ -152,13 +132,13 @@
152
132
  }
153
133
 
154
134
 
155
- /* APPLY TO STANDARD DROPDOWN ELEMENTS
156
- * =================================== */
135
+ // APPLY TO STANDARD DROPDOWN ELEMENTS
136
+ // ===================================
137
+
157
138
 
158
139
  $(document)
159
140
  .on('click.dropdown.data-api', clearMenus)
160
141
  .on('click.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
161
- .on('click.dropdown-menu', function (e) { e.stopPropagation() })
162
142
  .on('click.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
163
143
  .on('keydown.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
164
144