0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-03-15 15:29:22 +01:00

Merge branch 'master' of github.com:twbs/bootstrap

This commit is contained in:
Mark Otto 2013-12-07 11:41:02 -08:00
commit cc1f95652b
23 changed files with 119 additions and 61 deletions

View File

@ -1,6 +1,6 @@
/* jshint node: true */ /* jshint node: true */
module.exports = function(grunt) { module.exports = function (grunt) {
"use strict"; "use strict";
// Force use of Unix newlines // Force use of Unix newlines
@ -40,6 +40,21 @@ module.exports = function(grunt) {
} }
}, },
jscs: {
options: {
config: 'js/.jscs.json',
},
gruntfile: {
src: ['Gruntfile.js']
},
src: {
src: ['js/*.js']
},
test: {
src: ['js/tests/unit/*.js']
}
},
concat: { concat: {
options: { options: {
banner: '<%= banner %><%= jqueryCheck %>', banner: '<%= banner %><%= jqueryCheck %>',
@ -72,6 +87,16 @@ module.exports = function(grunt) {
bootstrap: { bootstrap: {
src: ['<%= concat.bootstrap.dest %>'], src: ['<%= concat.bootstrap.dest %>'],
dest: 'dist/js/<%= pkg.name %>.min.js' dest: 'dist/js/<%= pkg.name %>.min.js'
},
customize: {
src: [
'docs-assets/js/less.js',
'docs-assets/js/jszip.js',
'docs-assets/js/uglify.js',
'docs-assets/js/filesaver.js',
'docs-assets/js/customizer.js'
],
dest: 'docs-assets/js/customize.js'
} }
}, },
@ -278,6 +303,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-html-validation'); grunt.loadNpmTasks('grunt-html-validation');
grunt.loadNpmTasks('grunt-jekyll'); grunt.loadNpmTasks('grunt-jekyll');
grunt.loadNpmTasks('grunt-jscs-checker');
grunt.loadNpmTasks('grunt-recess'); grunt.loadNpmTasks('grunt-recess');
grunt.loadNpmTasks('grunt-saucelabs'); grunt.loadNpmTasks('grunt-saucelabs');
grunt.loadNpmTasks('grunt-sed'); grunt.loadNpmTasks('grunt-sed');
@ -286,7 +312,7 @@ module.exports = function(grunt) {
grunt.registerTask('validate-html', ['jekyll', 'validation']); grunt.registerTask('validate-html', ['jekyll', 'validation']);
// Test task. // Test task.
var testSubtasks = ['dist-css', 'jshint', 'qunit', 'validate-html']; var testSubtasks = ['dist-css', 'jshint', 'jscs', 'qunit', 'validate-html'];
// Only run Sauce Labs tests if there's a Sauce access key // Only run Sauce Labs tests if there's a Sauce access key
if (typeof process.env.SAUCE_ACCESS_KEY !== 'undefined') { if (typeof process.env.SAUCE_ACCESS_KEY !== 'undefined') {
testSubtasks.push('connect'); testSubtasks.push('connect');

View File

@ -2,19 +2,15 @@
================================================== --> ================================================== -->
<!-- Placed at the end of the document so the pages load faster --> <!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="{{ page.base_url }}dist/js/bootstrap.js"></script> <script src="{{ page.base_url }}dist/js/bootstrap.min.js"></script>
<script src="{{ page.base_url }}docs-assets/js/holder.js"></script> <script src="{{ page.base_url }}docs-assets/js/holder.js"></script>
<script src="{{ page.base_url }}docs-assets/js/application.js"></script> <script src="{{ page.base_url }}docs-assets/js/application.js"></script>
{% if page.slug == "customize" %} {% if page.slug == "customize" %}
<script src="{{ page.base_url }}docs-assets/js/less.js"></script>
<script src="{{ page.base_url }}docs-assets/js/jszip.js"></script>
<script src="{{ page.base_url }}docs-assets/js/uglify.js"></script>
<script src="{{ page.base_url }}docs-assets/js/filesaver.js"></script>
<script src="{{ page.base_url }}docs-assets/js/raw-files.js"></script> <script src="{{ page.base_url }}docs-assets/js/raw-files.js"></script>
<script src="{{ page.base_url }}docs-assets/js/customizer.js"></script> <script src="{{ page.base_url }}docs-assets/js/customize.js"></script>
{% endif %} {% endif %}
{% comment %} {% comment %}

View File

@ -88,6 +88,7 @@ base_url: "../"
<li><a href="http://www.oneskyapp.com/docs/bootstrap/ru">Bootstrap по-русски (Russian)</a></li> <li><a href="http://www.oneskyapp.com/docs/bootstrap/ru">Bootstrap по-русски (Russian)</a></li>
<li><a href="http://www.oneskyapp.com/docs/bootstrap/es">Bootstrap en Español (Spanish)</a></li> <li><a href="http://www.oneskyapp.com/docs/bootstrap/es">Bootstrap en Español (Spanish)</a></li>
<li><a href="http://twbs.site-konstruktor.com.ua">Bootstrap ua Українською (Ukrainian)</a></li> <li><a href="http://twbs.site-konstruktor.com.ua">Bootstrap ua Українською (Ukrainian)</a></li>
<li><a href="http://www.oneskyapp.com/docs/bootstrap/fr">Bootstrap en Français (French)</a></li>
</ul> </ul>
<p>Have another language to add, or perhaps a different or better translation? Let us know by <a href="https://github.com/twbs/bootstrap/issues/new">opening an issue</a>.</p> <p>Have another language to add, or perhaps a different or better translation? Let us know by <a href="https://github.com/twbs/bootstrap/issues/new">opening an issue</a>.</p>
</div> </div>

View File

@ -2,8 +2,8 @@
"name": "bootstrap", "name": "bootstrap",
"version": "3.0.3", "version": "3.0.3",
"main": [ "main": [
"./dist/js/bootstrap.js", "./dist/js/bootstrap.js",
"./dist/css/bootstrap.css", "./dist/css/bootstrap.css",
"./dist/fonts/glyphicons-halflings-regular.eot", "./dist/fonts/glyphicons-halflings-regular.eot",
"./dist/fonts/glyphicons-halflings-regular.svg", "./dist/fonts/glyphicons-halflings-regular.svg",
"./dist/fonts/glyphicons-halflings-regular.ttf", "./dist/fonts/glyphicons-halflings-regular.ttf",
@ -19,7 +19,6 @@
"CNAME", "CNAME",
"CONTRIBUTING.md", "CONTRIBUTING.md",
"Gruntfile.js", "Gruntfile.js",
"browserstack.json",
"composer.json", "composer.json",
"package.json", "package.json",
"*.html" "*.html"

View File

@ -1056,7 +1056,7 @@ base_url: "../"
<p class="help-block">Hovered dropdown menu entry text color</p> <p class="help-block">Hovered dropdown menu entry text color</p>
<label>@dropdown-link-hover-bg</label> <label>@dropdown-link-hover-bg</label>
<input type="text" class="form-control" placeholder="#f5f5f5" data-var="@dropdown-link-hover-bg"> <input type="text" class="form-control" placeholder="#f5f5f5" data-var="@dropdown-link-hover-bg">
<p class="help-block">Hovered dropdown menu entry text color</p> <p class="help-block">Hovered dropdown menu entry background color</p>
<label>@dropdown-link-active-color</label> <label>@dropdown-link-active-color</label>
<input type="text" class="form-control" placeholder="@component-active-color" data-var="@dropdown-link-active-color"> <input type="text" class="form-control" placeholder="@component-active-color" data-var="@dropdown-link-active-color">

View File

@ -4754,7 +4754,7 @@ textarea.input-group-sm > .input-group-btn > .btn {
} }
.navbar-default .navbar-toggle .icon-bar { .navbar-default .navbar-toggle .icon-bar {
background-color: #cccccc; background-color: #888888;
} }
.navbar-default .navbar-collapse, .navbar-default .navbar-collapse,

File diff suppressed because one or more lines are too long

View File

@ -1272,7 +1272,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery"
} }
} }
Tooltip.prototype.applyPlacement = function(offset, placement) { Tooltip.prototype.applyPlacement = function (offset, placement) {
var replace var replace
var $tip = this.tip() var $tip = this.tip()
var width = $tip[0].offsetWidth var width = $tip[0].offsetWidth
@ -1323,7 +1323,7 @@ if (typeof jQuery === "undefined") { throw new Error("Bootstrap requires jQuery"
if (replace) $tip.offset(offset) if (replace) $tip.offset(offset)
} }
Tooltip.prototype.replaceArrow = function(delta, dimension, position) { Tooltip.prototype.replaceArrow = function (delta, dimension, position) {
this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '') this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
} }

File diff suppressed because one or more lines are too long

View File

@ -687,6 +687,16 @@ bootstrap/
<td><code>.tabs-left</code> <code>.tabs-right</code> <code>.tabs-below</code></td> <td><code>.tabs-left</code> <code>.tabs-right</code> <code>.tabs-below</code></td>
<td class="text-muted">N/A</td> <td class="text-muted">N/A</td>
</tr> </tr>
<tr>
<td>Pill-based tabbable area</td>
<td><code>.pill-content</code></td>
<td><code>.tab-content</code></td>
</tr>
<tr>
<td>Pill-based tabbable area pane</td>
<td><code>.pill-pane</code></td>
<td><code>.tab-pane</code></td>
</tr>
<tr> <tr>
<td>Nav lists</td> <td>Nav lists</td>
<td><code>.nav-list</code> <code>.nav-header</code></td> <td><code>.nav-list</code> <code>.nav-header</code></td>

View File

@ -1123,7 +1123,7 @@ $('#myTooltip').on('hidden.bs.tooltip', function () {
<td>animation</td> <td>animation</td>
<td>boolean</td> <td>boolean</td>
<td>true</td> <td>true</td>
<td>apply a CSS fade transition to the tooltip</td> <td>apply a CSS fade transition to the popover</td>
</tr> </tr>
<tr> <tr>
<td>html</td> <td>html</td>
@ -1141,7 +1141,7 @@ $('#myTooltip').on('hidden.bs.tooltip', function () {
<td>selector</td> <td>selector</td>
<td>string</td> <td>string</td>
<td>false</td> <td>false</td>
<td>if a selector is provided, tooltip objects will be delegated to the specified targets. in practice, this is used to enable dynamic HTML content to have popovers added. See <a href="https://github.com/twbs/bootstrap/issues/4215">this</a> and <a href="http://jsfiddle.net/fScua/">an informative example</a>.</td> <td>if a selector is provided, tooltip objects will be delegated to the specified targets. In practice, this is used to enable dynamic HTML content to have popovers added. See <a href="https://github.com/twbs/bootstrap/issues/4215">this</a> and <a href="http://jsfiddle.net/fScua/">an informative example</a>.</td>
</tr> </tr>
<tr> <tr>
<td>trigger</td> <td>trigger</td>
@ -1941,7 +1941,7 @@ $('#myCarousel').on('slide.bs.carousel', function () {
<ol> <ol>
<li>To start, the plugin adds <code>.affix-top</code> to indicate the element is in it's top-most position. At this point no CSS positioning is required.</li> <li>To start, the plugin adds <code>.affix-top</code> to indicate the element is in it's top-most position. At this point no CSS positioning is required.</li>
<li>Scrolling past the element you want affixed should trigger the actual affixing. This is where <code>.affix</code> replaces <code>.affix-top</code> and sets <code>position: fixed;</code> (provided by Bootstrap's code CSS).</li> <li>Scrolling past the element you want affixed should trigger the actual affixing. This is where <code>.affix</code> replaces <code>.affix-top</code> and sets <code>position: fixed;</code> (provided by Bootstrap's code CSS).</li>
<li>If a bottom offset is defined, scrolling past that should replace <code>.affix</code> with <code>.affix-bottom</code>. Since offsets are optional, setting one requires you to set the appropriate CSS. In this case, add <code>position: absolute;</code> when necessary. The plugin uses the data attribute or JavaScript option to determine where to position the elemtn from there.</li> <li>If a bottom offset is defined, scrolling past that should replace <code>.affix</code> with <code>.affix-bottom</code>. Since offsets are optional, setting one requires you to set the appropriate CSS. In this case, add <code>position: absolute;</code> when necessary. The plugin uses the data attribute or JavaScript option to determine where to position the element from there.</li>
</ol> </ol>
<p>Follow the above steps to set your CSS for either of the usage options below.</p> <p>Follow the above steps to set your CSS for either of the usage options below.</p>

14
js/.jscs.json Normal file
View File

@ -0,0 +1,14 @@
{
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return"],
"requireSpacesInFunctionExpression": { "beforeOpeningCurlyBrace": true },
"disallowLeftStickedOperators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"requireRightStickedOperators": ["!"],
"disallowRightStickedOperators": ["?", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
"requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
"requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
"disallowKeywords": ["with"],
"validateLineBreaks": "LF",
"requireLineFeedAtFileEnd": true
}

View File

@ -85,7 +85,7 @@
if (e.keyCode == 38 && index > 0) index-- // up if (e.keyCode == 38 && index > 0) index-- // up
if (e.keyCode == 40 && index < $items.length - 1) index++ // down if (e.keyCode == 40 && index < $items.length - 1) index++ // down
if (!~index) index=0 if (!~index) index = 0
$items.eq(index).focus() $items.eq(index).focus()
} }

View File

@ -180,7 +180,7 @@
} else if (!this.isShown && this.$backdrop) { } else if (!this.isShown && this.$backdrop) {
this.$backdrop.removeClass('in') this.$backdrop.removeClass('in')
$.support.transition && this.$element.hasClass('fade')? $.support.transition && this.$element.hasClass('fade') ?
this.$backdrop this.$backdrop
.one($.support.transition.end, callback) .one($.support.transition.end, callback)
.emulateTransitionEnd(150) : .emulateTransitionEnd(150) :

View File

@ -74,7 +74,7 @@ $(function () {
ok($('#modal-test').length, 'modal inserted into dom') ok($('#modal-test').length, 'modal inserted into dom')
$(this).modal("hide") $(this).modal("hide")
}) })
.on("hidden.bs.modal", function() { .on("hidden.bs.modal", function () {
ok(!$('#modal-test').is(":visible"), 'modal hidden') ok(!$('#modal-test').is(":visible"), 'modal hidden')
$('#modal-test').remove() $('#modal-test').remove()
start() start()
@ -92,7 +92,7 @@ $(function () {
ok($('#modal-test').length, 'modal inserted into dom') ok($('#modal-test').length, 'modal inserted into dom')
div.modal("toggle") div.modal("toggle")
}) })
.on("hidden.bs.modal", function() { .on("hidden.bs.modal", function () {
ok(!$('#modal-test').is(":visible"), 'modal hidden') ok(!$('#modal-test').is(":visible"), 'modal hidden')
div.remove() div.remove()
start() start()
@ -110,7 +110,7 @@ $(function () {
ok($('#modal-test').length, 'modal inserted into dom') ok($('#modal-test').length, 'modal inserted into dom')
div.find('.close').click() div.find('.close').click()
}) })
.on("hidden.bs.modal", function() { .on("hidden.bs.modal", function () {
ok(!$('#modal-test').is(":visible"), 'modal hidden') ok(!$('#modal-test').is(":visible"), 'modal hidden')
div.remove() div.remove()
start() start()
@ -127,7 +127,7 @@ $(function () {
ok($('#modal-test').is(":visible"), 'modal visible') ok($('#modal-test').is(":visible"), 'modal visible')
div.modal("hide") div.modal("hide")
}) })
.on("hidden.bs.modal", function() { .on("hidden.bs.modal", function () {
ok(!$('#modal-test').is(":visible"), 'modal hidden') ok(!$('#modal-test').is(":visible"), 'modal hidden')
div.remove() div.remove()
start() start()
@ -146,7 +146,7 @@ $(function () {
ok($('#modal-test').is(":visible"), 'modal visible') ok($('#modal-test').is(":visible"), 'modal visible')
$('#modal-test').click() $('#modal-test').click()
}) })
.bind("hidden.bs.modal", function() { .bind("hidden.bs.modal", function () {
ok(!$('#modal-test').is(":visible"), 'modal hidden') ok(!$('#modal-test').is(":visible"), 'modal hidden')
div.remove() div.remove()
start() start()
@ -164,7 +164,7 @@ $(function () {
triggered = 0 triggered = 0
$('#modal-test').click() $('#modal-test').click()
}) })
.one("hidden.bs.modal", function() { .one("hidden.bs.modal", function () {
div.modal("show") div.modal("show")
}) })
.bind("hide.bs.modal", function () { .bind("hide.bs.modal", function () {
@ -184,7 +184,7 @@ $(function () {
$('#close').click() $('#close').click()
ok(!$('#modal-test').is(":visible"), 'modal hidden') ok(!$('#modal-test').is(":visible"), 'modal hidden')
}) })
.one("hidden.bs.modal", function() { .one("hidden.bs.modal", function () {
div.one('hidden.bs.modal', function () { div.one('hidden.bs.modal', function () {
start() start()
}).modal("show") }).modal("show")

View File

@ -22,7 +22,7 @@
} }
// These methods connect QUnit to PhantomJS. // These methods connect QUnit to PhantomJS.
QUnit.log = function(obj) { QUnit.log = function (obj) {
// What is this I dont even // What is this I dont even
if (obj.message === '[object Object], undefined:undefined') { return } if (obj.message === '[object Object], undefined:undefined') { return }
// Parse some stuff before sending it. // Parse some stuff before sending it.
@ -32,15 +32,15 @@
sendMessage('qunit.log', obj.result, actual, expected, obj.message, obj.source) sendMessage('qunit.log', obj.result, actual, expected, obj.message, obj.source)
} }
QUnit.testStart = function(obj) { QUnit.testStart = function (obj) {
sendMessage('qunit.testStart', obj.name) sendMessage('qunit.testStart', obj.name)
} }
QUnit.testDone = function(obj) { QUnit.testDone = function (obj) {
sendMessage('qunit.testDone', obj.name, obj.failed, obj.passed, obj.total) sendMessage('qunit.testDone', obj.name, obj.failed, obj.passed, obj.total)
} }
QUnit.moduleStart = function(obj) { QUnit.moduleStart = function (obj) {
sendMessage('qunit.moduleStart', obj.name) sendMessage('qunit.moduleStart', obj.name)
} }

View File

@ -97,7 +97,7 @@ $(function () {
$('#qunit-fixture').empty() $('#qunit-fixture').empty()
}) })
test("should respect custom classes", function() { test("should respect custom classes", function () {
$.support.transition = false $.support.transition = false
var popover = $('<a href="#">@fat</a>') var popover = $('<a href="#">@fat</a>')
.appendTo('#qunit-fixture') .appendTo('#qunit-fixture')
@ -118,7 +118,7 @@ $(function () {
}) })
test("should destroy popover", function () { test("should destroy popover", function () {
var popover = $('<div/>').popover({trigger: 'hover'}).on('click.foo', function(){}) var popover = $('<div/>').popover({trigger: 'hover'}).on('click.foo', function () {})
ok(popover.data('bs.popover'), 'popover has data') ok(popover.data('bs.popover'), 'popover has data')
ok($._data(popover[0], 'events').mouseover && $._data(popover[0], 'events').mouseout, 'popover has hover 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') ok($._data(popover[0], 'events').click[0].namespace == 'foo', 'popover has extra click.foo event')

View File

@ -19,7 +19,7 @@ $(function () {
test("should switch active class on scroll", function () { test("should switch active class on scroll", function () {
var sectionHTML = '<div id="masthead"></div>' var sectionHTML = '<div id="masthead"></div>'
, $section = $(sectionHTML).append('#qunit-fixture') , $section = $(sectionHTML).append('#qunit-fixture')
, topbarHTML ='<div class="topbar">' , topbarHTML = '<div class="topbar">'
+ '<div class="topbar-inner">' + '<div class="topbar-inner">'
+ '<div class="container">' + '<div class="container">'
+ '<h3><a href="#">Bootstrap</a></h3>' + '<h3><a href="#">Bootstrap</a></h3>'

View File

@ -76,9 +76,9 @@ $(function () {
+ '</ul>' + '</ul>'
$(dropHTML).find('ul>li:first a').tab('show').end() $(dropHTML).find('ul>li:first a').tab('show').end()
.find('ul>li:last a').on('show', function(event){ .find('ul>li:last a').on('show', function (event) {
equal(event.relatedTarget.hash, "#1-1") equal(event.relatedTarget.hash, "#1-1")
}).on('shown', function(event){ }).on('shown', function (event) {
equal(event.relatedTarget.hash, "#1-1") equal(event.relatedTarget.hash, "#1-1")
}).tab('show') }).tab('show')
}) })

View File

@ -69,7 +69,7 @@ $(function () {
test("should fire show event", function () { test("should fire show event", function () {
stop() stop()
var tooltip = $('<div title="tooltip title"></div>') var tooltip = $('<div title="tooltip title"></div>')
.on("show.bs.tooltip", function() { .on("show.bs.tooltip", function () {
ok(true, "show was called") ok(true, "show was called")
start() start()
}) })
@ -79,7 +79,7 @@ $(function () {
test("should fire shown event", function () { test("should fire shown event", function () {
stop() stop()
var tooltip = $('<div title="tooltip title"></div>') var tooltip = $('<div title="tooltip title"></div>')
.on("shown.bs.tooltip", function() { .on("shown.bs.tooltip", function () {
ok(true, "shown was called") ok(true, "shown was called")
start() start()
}) })
@ -89,12 +89,12 @@ $(function () {
test("should not fire shown event when default prevented", function () { test("should not fire shown event when default prevented", function () {
stop() stop()
var tooltip = $('<div title="tooltip title"></div>') var tooltip = $('<div title="tooltip title"></div>')
.on("show.bs.tooltip", function(e) { .on("show.bs.tooltip", function (e) {
e.preventDefault() e.preventDefault()
ok(true, "show was called") ok(true, "show was called")
start() start()
}) })
.on("shown.bs.tooltip", function() { .on("shown.bs.tooltip", function () {
ok(false, "shown was called") ok(false, "shown was called")
}) })
.tooltip('show') .tooltip('show')
@ -103,10 +103,10 @@ $(function () {
test("should fire hide event", function () { test("should fire hide event", function () {
stop() stop()
var tooltip = $('<div title="tooltip title"></div>') var tooltip = $('<div title="tooltip title"></div>')
.on("shown.bs.tooltip", function() { .on("shown.bs.tooltip", function () {
$(this).tooltip('hide') $(this).tooltip('hide')
}) })
.on("hide.bs.tooltip", function() { .on("hide.bs.tooltip", function () {
ok(true, "hide was called") ok(true, "hide was called")
start() start()
}) })
@ -116,10 +116,10 @@ $(function () {
test("should fire hidden event", function () { test("should fire hidden event", function () {
stop() stop()
var tooltip = $('<div title="tooltip title"></div>') var tooltip = $('<div title="tooltip title"></div>')
.on("shown.bs.tooltip", function() { .on("shown.bs.tooltip", function () {
$(this).tooltip('hide') $(this).tooltip('hide')
}) })
.on("hidden.bs.tooltip", function() { .on("hidden.bs.tooltip", function () {
ok(true, "hidden was called") ok(true, "hidden was called")
start() start()
}) })
@ -129,15 +129,15 @@ $(function () {
test("should not fire hidden event when default prevented", function () { test("should not fire hidden event when default prevented", function () {
stop() stop()
var tooltip = $('<div title="tooltip title"></div>') var tooltip = $('<div title="tooltip title"></div>')
.on("shown.bs.tooltip", function() { .on("shown.bs.tooltip", function () {
$(this).tooltip('hide') $(this).tooltip('hide')
}) })
.on("hide.bs.tooltip", function(e) { .on("hide.bs.tooltip", function (e) {
e.preventDefault() e.preventDefault()
ok(true, "hide was called") ok(true, "hide was called")
start() start()
}) })
.on("hidden.bs.tooltip", function() { .on("hidden.bs.tooltip", function () {
ok(false, "hidden was called") ok(false, "hidden was called")
}) })
.tooltip('show') .tooltip('show')
@ -258,7 +258,7 @@ $(function () {
}) })
test("should destroy tooltip", function () { test("should destroy tooltip", function () {
var tooltip = $('<div/>').tooltip().on('click.foo', function(){}) var tooltip = $('<div/>').tooltip().on('click.foo', function () {})
ok(tooltip.data('bs.tooltip'), 'tooltip has data') ok(tooltip.data('bs.tooltip'), 'tooltip has data')
ok($._data(tooltip[0], 'events').mouseover && $._data(tooltip[0], 'events').mouseout, 'tooltip has hover 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') ok($._data(tooltip[0], 'events').click[0].namespace == 'foo', 'tooltip has extra click.foo event')
@ -290,25 +290,25 @@ $(function () {
test("should place tooltips inside the body", function () { test("should place tooltips inside the body", function () {
var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>') var tooltip = $('<a href="#" rel="tooltip" title="Another tooltip"></a>')
.appendTo('#qunit-fixture') .appendTo('#qunit-fixture')
.tooltip({container:'body'}) .tooltip({container: 'body'})
.tooltip('show') .tooltip('show')
ok($("body > .tooltip").length, 'inside the body') ok($("body > .tooltip").length, 'inside the body')
ok(!$("#qunit-fixture > .tooltip").length, 'not found in parent') ok(!$("#qunit-fixture > .tooltip").length, 'not found in parent')
tooltip.tooltip('hide') tooltip.tooltip('hide')
}) })
test("should place tooltip inside window", function(){ test("should place tooltip inside window", function () {
var container = $("<div />").appendTo("body") var container = $("<div />").appendTo("body")
.css({position: "absolute", width: 200, height: 200, bottom: 0, left: 0}) .css({position: "absolute", width: 200, height: 200, bottom: 0, left: 0})
, tooltip = $("<a href='#' title='Very very very very very very very very long tooltip'>Hover me</a>") , tooltip = $("<a href='#' title='Very very very very very very very very long tooltip'>Hover me</a>")
.css({position: "absolute", top:0, left: 0}) .css({position: "absolute", top: 0, left: 0})
.appendTo(container) .appendTo(container)
.tooltip({placement: "top", animate: false}) .tooltip({placement: "top", animate: false})
.tooltip("show") .tooltip("show")
stop() stop()
setTimeout(function(){ setTimeout(function () {
ok($(".tooltip").offset().left >= 0) ok($(".tooltip").offset().left >= 0)
start() start()
@ -316,7 +316,7 @@ $(function () {
}, 100) }, 100)
}) })
test("should place tooltip on top of element", function(){ test("should place tooltip on top of element", function () {
var container = $("<div />").appendTo("body") var container = $("<div />").appendTo("body")
.css({position: "absolute", bottom: 0, left: 0, textAlign: "right", width: 300, height: 300}) .css({position: "absolute", bottom: 0, left: 0, textAlign: "right", width: 300, height: 300})
, p = $("<p style='margin-top:200px' />").appendTo(container) , p = $("<p style='margin-top:200px' />").appendTo(container)
@ -328,7 +328,7 @@ $(function () {
stop() stop()
setTimeout(function(){ setTimeout(function () {
var tooltip = container.find(".tooltip") var tooltip = container.find(".tooltip")
start() start()
@ -337,7 +337,7 @@ $(function () {
}, 100) }, 100)
}) })
test("should add position class before positioning so that position-specific styles are taken into account", function(){ test("should add position class before positioning so that position-specific styles are taken into account", function () {
$("head").append('<style> .tooltip.right { white-space: nowrap; } .tooltip.right .tooltip-inner { max-width: none; } </style>') $("head").append('<style> .tooltip.right { white-space: nowrap; } .tooltip.right .tooltip-inner { max-width: none; } </style>')
var container = $("<div />").appendTo("body") var container = $("<div />").appendTo("body")
@ -347,7 +347,7 @@ $(function () {
.tooltip('show') .tooltip('show')
, tooltip = container.find(".tooltip") , tooltip = container.find(".tooltip")
ok( Math.round(target.offset().top + target[0].offsetHeight/2 - tooltip[0].offsetHeight/2) === Math.round(tooltip.offset().top) ) ok( Math.round(target.offset().top + (target[0].offsetHeight / 2) - (tooltip[0].offsetHeight / 2)) === Math.round(tooltip.offset().top) )
target.tooltip('hide') target.tooltip('hide')
}) })

View File

@ -133,7 +133,7 @@
} }
Tooltip.prototype.show = function () { Tooltip.prototype.show = function () {
var e = $.Event('show.bs.'+ this.type) var e = $.Event('show.bs.' + this.type)
if (this.hasContent() && this.enabled) { if (this.hasContent() && this.enabled) {
this.$element.trigger(e) this.$element.trigger(e)
@ -192,7 +192,7 @@
} }
} }
Tooltip.prototype.applyPlacement = function(offset, placement) { Tooltip.prototype.applyPlacement = function (offset, placement) {
var replace var replace
var $tip = this.tip() var $tip = this.tip()
var width = $tip[0].offsetWidth var width = $tip[0].offsetWidth
@ -243,7 +243,7 @@
if (replace) $tip.offset(offset) if (replace) $tip.offset(offset)
} }
Tooltip.prototype.replaceArrow = function(delta, dimension, position) { Tooltip.prototype.replaceArrow = function (delta, dimension, position) {
this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '') this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + "%") : '')
} }

View File

@ -286,7 +286,7 @@
// Navbar toggle // Navbar toggle
@navbar-default-toggle-hover-bg: #ddd; @navbar-default-toggle-hover-bg: #ddd;
@navbar-default-toggle-icon-bar-bg: #ccc; @navbar-default-toggle-icon-bar-bg: #888;
@navbar-default-toggle-border-color: #ddd; @navbar-default-toggle-border-color: #ddd;

View File

@ -32,6 +32,7 @@
, "grunt-contrib-watch": "~0.5.3" , "grunt-contrib-watch": "~0.5.3"
, "grunt-html-validation": "~0.1.6" , "grunt-html-validation": "~0.1.6"
, "grunt-jekyll": "~0.4.0" , "grunt-jekyll": "~0.4.0"
, "grunt-jscs-checker": "~0.2.5"
, "grunt-recess": "~0.5.0" , "grunt-recess": "~0.5.0"
, "grunt-saucelabs": "~4.1.2" , "grunt-saucelabs": "~4.1.2"
, "grunt-sed": "~0.1.1" , "grunt-sed": "~0.1.1"