Skip to content

Commit c3ea955

Browse files
committed
Merge branch '2.1.2-wip' of github.com:twitter/bootstrap into 2.1.2-wip
2 parents a419e70 + ebf94c5 commit c3ea955

12 files changed

+65
-47
lines changed

docs/assets/js/bootstrap-transition.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020

2121
!function ($) {
2222

23-
$(function () {
23+
"use strict"; // jshint ;_;
2424

25-
"use strict"; // jshint ;_;
2625

26+
/* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
27+
* ======================================================= */
2728

28-
/* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
29-
* ======================================================= */
29+
$(function () {
3030

3131
$.support.transition = (function () {
3232

docs/assets/js/bootstrap-typeahead.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174
.on('keypress', $.proxy(this.keypress, this))
175175
.on('keyup', $.proxy(this.keyup, this))
176176

177-
if ($.browser.chrome || $.browser.webkit || $.browser.msie) {
177+
if (this.eventSupported('keydown')) {
178178
this.$element.on('keydown', $.proxy(this.keydown, this))
179179
}
180180

@@ -183,6 +183,15 @@
183183
.on('mouseenter', 'li', $.proxy(this.mouseenter, this))
184184
}
185185

186+
, eventSupported: function(eventName) {
187+
var isSupported = eventName in this.$element
188+
if (!isSupported) {
189+
this.$element.setAttribute(eventName, 'return;')
190+
isSupported = typeof this.$element[eventName] === 'function'
191+
}
192+
return isSupported
193+
}
194+
186195
, move: function (e) {
187196
if (!this.shown) return
188197

docs/assets/js/bootstrap.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020

2121
!function ($) {
2222

23-
$(function () {
23+
"use strict"; // jshint ;_;
2424

25-
"use strict"; // jshint ;_;
2625

26+
/* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
27+
* ======================================================= */
2728

28-
/* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
29-
* ======================================================= */
29+
$(function () {
3030

3131
$.support.transition = (function () {
3232

@@ -1797,7 +1797,7 @@
17971797
.on('keypress', $.proxy(this.keypress, this))
17981798
.on('keyup', $.proxy(this.keyup, this))
17991799

1800-
if ($.browser.chrome || $.browser.webkit || $.browser.msie) {
1800+
if (this.eventSupported('keydown')) {
18011801
this.$element.on('keydown', $.proxy(this.keydown, this))
18021802
}
18031803

@@ -1806,6 +1806,15 @@
18061806
.on('mouseenter', 'li', $.proxy(this.mouseenter, this))
18071807
}
18081808

1809+
, eventSupported: function(eventName) {
1810+
var isSupported = eventName in this.$element
1811+
if (!isSupported) {
1812+
this.$element.setAttribute(eventName, 'return;')
1813+
isSupported = typeof this.$element[eventName] === 'function'
1814+
}
1815+
return isSupported
1816+
}
1817+
18091818
, move: function (e) {
18101819
if (!this.shown) return
18111820

docs/assets/js/bootstrap.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/assets/js/jquery.js

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/bootstrap-transition.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020

2121
!function ($) {
2222

23-
$(function () {
23+
"use strict"; // jshint ;_;
2424

25-
"use strict"; // jshint ;_;
2625

26+
/* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
27+
* ======================================================= */
2728

28-
/* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
29-
* ======================================================= */
29+
$(function () {
3030

3131
$.support.transition = (function () {
3232

js/bootstrap-typeahead.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174
.on('keypress', $.proxy(this.keypress, this))
175175
.on('keyup', $.proxy(this.keyup, this))
176176

177-
if ($.browser.chrome || $.browser.webkit || $.browser.msie) {
177+
if (this.eventSupported('keydown')) {
178178
this.$element.on('keydown', $.proxy(this.keydown, this))
179179
}
180180

@@ -183,6 +183,15 @@
183183
.on('mouseenter', 'li', $.proxy(this.mouseenter, this))
184184
}
185185

186+
, eventSupported: function(eventName) {
187+
var isSupported = eventName in this.$element
188+
if (!isSupported) {
189+
this.$element.setAttribute(eventName, 'return;')
190+
isSupported = typeof this.$element[eventName] === 'function'
191+
}
192+
return isSupported
193+
}
194+
186195
, move: function (e) {
187196
if (!this.shown) return
188197

js/tests/unit/bootstrap-carousel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ $(function () {
2626
})
2727

2828
test("should fire slide event with relatedTarget", function () {
29-
var template = '<div id="myCarousel" class="carousel slide"><div class="carousel-inner"><div class="item active"><img src="assets/img/bootstrap-mdo-sfmoma-01.jpg" alt=""><div class="carousel-caption"><h4>{{_i}}First Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div><div class="item"><img src="assets/img/bootstrap-mdo-sfmoma-02.jpg" alt=""><div class="carousel-caption"><h4>{{_i}}Second Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div><div class="item"><img src="assets/img/bootstrap-mdo-sfmoma-03.jpg" alt=""><div class="carousel-caption"><h4>{{_i}}Third Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div></div><a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a><a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a></div>'
29+
var template = '<div id="myCarousel" class="carousel slide"><div class="carousel-inner"><div class="item active"><img alt=""><div class="carousel-caption"><h4>{{_i}}First Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div><div class="item"><img alt=""><div class="carousel-caption"><h4>{{_i}}Second Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div><div class="item"><img alt=""><div class="carousel-caption"><h4>{{_i}}Third Thumbnail label{{/i}}</h4><p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p></div></div></div><a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a><a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a></div>'
3030
$.support.transition = false
3131
stop()
3232
$(template)

js/tests/unit/bootstrap-popover.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ $(function () {
9494
test("should destroy popover", function () {
9595
var popover = $('<div/>').popover({trigger: 'hover'}).on('click.foo', function(){})
9696
ok(popover.data('popover'), 'popover has data')
97-
ok(popover.data('events').mouseover && popover.data('events').mouseout, 'popover has hover event')
98-
ok(popover.data('events').click[0].namespace == 'foo', 'popover has extra click.foo event')
97+
ok($._data(popover[0], 'events').mouseover && $._data(popover[0], 'events').mouseout, 'popover has hover event')
98+
ok($._data(popover[0], 'events').click[0].namespace == 'foo', 'popover has extra click.foo event')
9999
popover.popover('show')
100100
popover.popover('destroy')
101101
ok(!popover.hasClass('in'), 'popover is hidden')
102102
ok(!popover.data('popover'), 'popover does not have data')
103-
ok(popover.data('events').click[0].namespace == 'foo', 'popover still has click.foo')
104-
ok(!popover.data('events').mouseover && !popover.data('events').mouseout, 'popover does not have any events')
103+
ok($._data(popover[0],'events').click[0].namespace == 'foo', 'popover still has click.foo')
104+
ok(!$._data(popover[0], 'events').mouseover && !$._data(popover[0], 'events').mouseout, 'popover does not have any events')
105105
})
106106

107107
})

js/tests/unit/bootstrap-tooltip.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ $(function () {
113113
}, 50)
114114
})
115115

116-
test("should show tooltip if leave event hasn't occurred before delay expires", function () {
116+
test("should show tooltip if leave event hasn't occured before delay expires", function () {
117117
var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
118118
.appendTo('#qunit-fixture')
119119
.tooltip({ delay: 150 })
@@ -131,14 +131,14 @@ $(function () {
131131
test("should destroy tooltip", function () {
132132
var tooltip = $('<div/>').tooltip().on('click.foo', function(){})
133133
ok(tooltip.data('tooltip'), 'tooltip has data')
134-
ok(tooltip.data('events').mouseover && tooltip.data('events').mouseout, 'tooltip has hover event')
135-
ok(tooltip.data('events').click[0].namespace == 'foo', 'tooltip has extra click.foo event')
134+
ok($._data(tooltip[0], 'events').mouseover && $._data(tooltip[0], 'events').mouseout, 'tooltip has hover event')
135+
ok($._data(tooltip[0], 'events').click[0].namespace == 'foo', 'tooltip has extra click.foo event')
136136
tooltip.tooltip('show')
137137
tooltip.tooltip('destroy')
138138
ok(!tooltip.hasClass('in'), 'tooltip is hidden')
139-
ok(!tooltip.data('tooltip'), 'tooltip does not have data')
140-
ok(tooltip.data('events').click[0].namespace == 'foo', 'tooltip still has click.foo')
141-
ok(!tooltip.data('events').mouseover && !tooltip.data('events').mouseout, 'tooltip does not have any events')
139+
ok(!$._data(tooltip[0], 'tooltip'), 'tooltip does not have data')
140+
ok($._data(tooltip[0], 'events').click[0].namespace == 'foo', 'tooltip still has click.foo')
141+
ok(!$._data(tooltip[0], 'events').mouseover && !$._data(tooltip[0], 'events').mouseout, 'tooltip does not have any events')
142142
})
143143

144-
})
144+
})

js/tests/unit/bootstrap-typeahead.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,9 @@ $(function () {
1313
test("should listen to an input", function () {
1414
var $input = $('<input />')
1515
$input.typeahead()
16-
ok($input.data('events').blur, 'has a blur event')
17-
ok($input.data('events').keypress, 'has a keypress event')
18-
ok($input.data('events').keyup, 'has a keyup event')
19-
if ($.browser.webkit || $.browser.msie) {
20-
ok($input.data('events').keydown, 'has a keydown event')
21-
} else {
22-
ok($input.data('events').keydown, 'does not have a keydown event')
23-
}
16+
ok($._data($input[0], 'events').blur, 'has a blur event')
17+
ok($._data($input[0], 'events').keypress, 'has a keypress event')
18+
ok($._data($input[0], 'events').keyup, 'has a keyup event')
2419
})
2520

2621
test("should create a menu", function () {
@@ -32,8 +27,8 @@ $(function () {
3227
var $input = $('<input />')
3328
, $menu = $input.typeahead().data('typeahead').$menu
3429

35-
ok($menu.data('events').mouseover, 'has a mouseover(pseudo: mouseenter)')
36-
ok($menu.data('events').click, 'has a click')
30+
ok($._data($menu[0], 'events').mouseover, 'has a mouseover(pseudo: mouseenter)')
31+
ok($._data($menu[0], 'events').click, 'has a click')
3732
})
3833

3934
test("should show menu when query entered", function () {
@@ -201,4 +196,4 @@ $(function () {
201196

202197
typeahead.$menu.remove()
203198
})
204-
})
199+
})

js/tests/vendor/jquery.js

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)