Skip to content

Commit

Permalink
Merge branch '2.1.2-wip' of github.com:twitter/bootstrap into 2.1.2-wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mdo committed Sep 23, 2012
2 parents a419e70 + ebf94c5 commit c3ea955
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 47 deletions.
8 changes: 4 additions & 4 deletions docs/assets/js/bootstrap-transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@

!function ($) {

$(function () {
"use strict"; // jshint ;_;

"use strict"; // jshint ;_;

/* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
* ======================================================= */

/* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
* ======================================================= */
$(function () {

$.support.transition = (function () {

Expand Down
11 changes: 10 additions & 1 deletion docs/assets/js/bootstrap-typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
.on('keypress', $.proxy(this.keypress, this))
.on('keyup', $.proxy(this.keyup, this))

if ($.browser.chrome || $.browser.webkit || $.browser.msie) {
if (this.eventSupported('keydown')) {
this.$element.on('keydown', $.proxy(this.keydown, this))
}

Expand All @@ -183,6 +183,15 @@
.on('mouseenter', 'li', $.proxy(this.mouseenter, this))
}

, eventSupported: function(eventName) {
var isSupported = eventName in this.$element
if (!isSupported) {
this.$element.setAttribute(eventName, 'return;')
isSupported = typeof this.$element[eventName] === 'function'
}
return isSupported
}

, move: function (e) {
if (!this.shown) return

Expand Down
19 changes: 14 additions & 5 deletions docs/assets/js/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@

!function ($) {

$(function () {
"use strict"; // jshint ;_;

"use strict"; // jshint ;_;

/* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
* ======================================================= */

/* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
* ======================================================= */
$(function () {

$.support.transition = (function () {

Expand Down Expand Up @@ -1797,7 +1797,7 @@
.on('keypress', $.proxy(this.keypress, this))
.on('keyup', $.proxy(this.keyup, this))

if ($.browser.chrome || $.browser.webkit || $.browser.msie) {
if (this.eventSupported('keydown')) {
this.$element.on('keydown', $.proxy(this.keydown, this))
}

Expand All @@ -1806,6 +1806,15 @@
.on('mouseenter', 'li', $.proxy(this.mouseenter, this))
}

, eventSupported: function(eventName) {
var isSupported = eventName in this.$element
if (!isSupported) {
this.$element.setAttribute(eventName, 'return;')
isSupported = typeof this.$element[eventName] === 'function'
}
return isSupported
}

, move: function (e) {
if (!this.shown) return

Expand Down
2 changes: 1 addition & 1 deletion docs/assets/js/bootstrap.min.js

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions docs/assets/js/jquery.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions js/bootstrap-transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@

!function ($) {

$(function () {
"use strict"; // jshint ;_;

"use strict"; // jshint ;_;

/* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
* ======================================================= */

/* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
* ======================================================= */
$(function () {

$.support.transition = (function () {

Expand Down
11 changes: 10 additions & 1 deletion js/bootstrap-typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
.on('keypress', $.proxy(this.keypress, this))
.on('keyup', $.proxy(this.keyup, this))

if ($.browser.chrome || $.browser.webkit || $.browser.msie) {
if (this.eventSupported('keydown')) {
this.$element.on('keydown', $.proxy(this.keydown, this))
}

Expand All @@ -183,6 +183,15 @@
.on('mouseenter', 'li', $.proxy(this.mouseenter, this))
}

, eventSupported: function(eventName) {
var isSupported = eventName in this.$element
if (!isSupported) {
this.$element.setAttribute(eventName, 'return;')
isSupported = typeof this.$element[eventName] === 'function'
}
return isSupported
}

, move: function (e) {
if (!this.shown) return

Expand Down
2 changes: 1 addition & 1 deletion js/tests/unit/bootstrap-carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ $(function () {
})

test("should fire slide event with relatedTarget", function () {
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>'
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>'
$.support.transition = false
stop()
$(template)
Expand Down
8 changes: 4 additions & 4 deletions js/tests/unit/bootstrap-popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ $(function () {
test("should destroy popover", function () {
var popover = $('<div/>').popover({trigger: 'hover'}).on('click.foo', function(){})
ok(popover.data('popover'), 'popover has data')
ok(popover.data('events').mouseover && popover.data('events').mouseout, 'popover has hover event')
ok(popover.data('events').click[0].namespace == 'foo', 'popover has extra click.foo event')
ok($._data(popover[0], 'events').mouseover && $._data(popover[0], 'events').mouseout, 'popover has hover event')
ok($._data(popover[0], 'events').click[0].namespace == 'foo', 'popover has extra click.foo event')
popover.popover('show')
popover.popover('destroy')
ok(!popover.hasClass('in'), 'popover is hidden')
ok(!popover.data('popover'), 'popover does not have data')
ok(popover.data('events').click[0].namespace == 'foo', 'popover still has click.foo')
ok(!popover.data('events').mouseover && !popover.data('events').mouseout, 'popover does not have any events')
ok($._data(popover[0],'events').click[0].namespace == 'foo', 'popover still has click.foo')
ok(!$._data(popover[0], 'events').mouseover && !$._data(popover[0], 'events').mouseout, 'popover does not have any events')
})

})
14 changes: 7 additions & 7 deletions js/tests/unit/bootstrap-tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ $(function () {
}, 50)
})

test("should show tooltip if leave event hasn't occurred before delay expires", function () {
test("should show tooltip if leave event hasn't occured before delay expires", function () {
var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
.appendTo('#qunit-fixture')
.tooltip({ delay: 150 })
Expand All @@ -131,14 +131,14 @@ $(function () {
test("should destroy tooltip", function () {
var tooltip = $('<div/>').tooltip().on('click.foo', function(){})
ok(tooltip.data('tooltip'), 'tooltip has data')
ok(tooltip.data('events').mouseover && tooltip.data('events').mouseout, 'tooltip has hover event')
ok(tooltip.data('events').click[0].namespace == 'foo', 'tooltip has extra click.foo event')
ok($._data(tooltip[0], 'events').mouseover && $._data(tooltip[0], 'events').mouseout, 'tooltip has hover event')
ok($._data(tooltip[0], 'events').click[0].namespace == 'foo', 'tooltip has extra click.foo event')
tooltip.tooltip('show')
tooltip.tooltip('destroy')
ok(!tooltip.hasClass('in'), 'tooltip is hidden')
ok(!tooltip.data('tooltip'), 'tooltip does not have data')
ok(tooltip.data('events').click[0].namespace == 'foo', 'tooltip still has click.foo')
ok(!tooltip.data('events').mouseover && !tooltip.data('events').mouseout, 'tooltip does not have any events')
ok(!$._data(tooltip[0], 'tooltip'), 'tooltip does not have data')
ok($._data(tooltip[0], 'events').click[0].namespace == 'foo', 'tooltip still has click.foo')
ok(!$._data(tooltip[0], 'events').mouseover && !$._data(tooltip[0], 'events').mouseout, 'tooltip does not have any events')
})

})
})
17 changes: 6 additions & 11 deletions js/tests/unit/bootstrap-typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,9 @@ $(function () {
test("should listen to an input", function () {
var $input = $('<input />')
$input.typeahead()
ok($input.data('events').blur, 'has a blur event')
ok($input.data('events').keypress, 'has a keypress event')
ok($input.data('events').keyup, 'has a keyup event')
if ($.browser.webkit || $.browser.msie) {
ok($input.data('events').keydown, 'has a keydown event')
} else {
ok($input.data('events').keydown, 'does not have a keydown event')
}
ok($._data($input[0], 'events').blur, 'has a blur event')
ok($._data($input[0], 'events').keypress, 'has a keypress event')
ok($._data($input[0], 'events').keyup, 'has a keyup event')
})

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

ok($menu.data('events').mouseover, 'has a mouseover(pseudo: mouseenter)')
ok($menu.data('events').click, 'has a click')
ok($._data($menu[0], 'events').mouseover, 'has a mouseover(pseudo: mouseenter)')
ok($._data($menu[0], 'events').click, 'has a click')
})

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

typeahead.$menu.remove()
})
})
})
6 changes: 2 additions & 4 deletions js/tests/vendor/jquery.js

Large diffs are not rendered by default.

0 comments on commit c3ea955

Please sign in to comment.