0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-01-18 10:52:19 +01:00

Merge pull request #13091 from twbs/unused-js

Remove unused javascript
This commit is contained in:
XhmikosR 2014-04-09 10:07:35 +03:00
commit ee2df11e93
16 changed files with 37 additions and 38 deletions

View File

@ -1243,7 +1243,6 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
}
Tooltip.prototype.applyPlacement = function (offset, placement) {
var replace
var $tip = this.tip()
var width = $tip[0].offsetWidth
var height = $tip[0].offsetHeight
@ -1626,7 +1625,8 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
this.targets = $([])
var self = this
var $targets = this.$body
this.$body
.find(this.selector)
.map(function () {
var $el = $(this)

File diff suppressed because one or more lines are too long

View File

@ -31,11 +31,8 @@
var $window = $(window)
var $body = $(document.body)
var navHeight = $('.navbar').outerHeight(true) + 10
$body.scrollspy({
target: '.bs-docs-sidebar',
// offset: navHeight
target: '.bs-docs-sidebar'
})
$window.on('load', function () {

View File

@ -231,7 +231,9 @@ window.onload = function () { // wait for load in a dumb way because B-0
paths: ['variables.less', 'mixins.less'],
optimization: 0,
filename: baseFilename + '.css'
}).parse(lessSource, function (err, tree) {
})
parser.parse(lessSource, function (err, tree) {
if (err) {
return showError('<strong>Ruh roh!</strong> Could not parse less files.', err)
}
@ -331,7 +333,6 @@ window.onload = function () { // wait for load in a dumb way because B-0
})
var $compileBtn = $('#btn-compile')
var $downloadBtn = $('#btn-download')
$compileBtn.on('click', function (e) {
var configData = getCustomizerData()

File diff suppressed because one or more lines are too long

View File

@ -13,4 +13,4 @@ var Holder=Holder||{};!function(a,b){function c(a,b,c){b=parseInt(b,10),a=parseI
* Licensed under the Creative Commons Attribution 3.0 Unported License. For
* details, see http://creativecommons.org/licenses/by/3.0/.
*/
!function(a){a(function(){if(navigator.userAgent.match(/IEMobile\/10\.0/)){var b=document.createElement("style");b.appendChild(document.createTextNode("@-ms-viewport{width:auto!important}")),document.querySelector("head").appendChild(b)}{var c=a(window),d=a(document.body);a(".navbar").outerHeight(!0)+10}d.scrollspy({target:".bs-docs-sidebar"}),c.on("load",function(){d.scrollspy("refresh")}),a(".bs-docs-container [href=#]").click(function(a){a.preventDefault()}),setTimeout(function(){var b=a(".bs-docs-sidebar");b.affix({offset:{top:function(){var c=b.offset().top,d=parseInt(b.children(0).css("margin-top"),10),e=a(".bs-docs-nav").height();return this.top=c-e-d},bottom:function(){return this.bottom=a(".bs-docs-footer").outerHeight(!0)}}})},100),setTimeout(function(){a(".bs-top").affix()},100),a(".tooltip-demo").tooltip({selector:"[data-toggle=tooltip]",container:"body"}),a(".tooltip-test").tooltip(),a(".popover-test").popover(),a(".bs-docs-navbar").tooltip({selector:"a[data-toggle=tooltip]",container:".bs-docs-navbar .nav"}),a(".bs-docs-popover").popover(),a(".bs-docs-popover-dismiss").popover({trigger:"focus"}),a("#loading-example-btn").click(function(){var b=a(this);b.button("loading"),setTimeout(function(){b.button("reset")},3e3)})})}(jQuery);
!function(a){a(function(){if(navigator.userAgent.match(/IEMobile\/10\.0/)){var b=document.createElement("style");b.appendChild(document.createTextNode("@-ms-viewport{width:auto!important}")),document.querySelector("head").appendChild(b)}var c=a(window),d=a(document.body);d.scrollspy({target:".bs-docs-sidebar"}),c.on("load",function(){d.scrollspy("refresh")}),a(".bs-docs-container [href=#]").click(function(a){a.preventDefault()}),setTimeout(function(){var b=a(".bs-docs-sidebar");b.affix({offset:{top:function(){var c=b.offset().top,d=parseInt(b.children(0).css("margin-top"),10),e=a(".bs-docs-nav").height();return this.top=c-e-d},bottom:function(){return this.bottom=a(".bs-docs-footer").outerHeight(!0)}}})},100),setTimeout(function(){a(".bs-top").affix()},100),a(".tooltip-demo").tooltip({selector:"[data-toggle=tooltip]",container:"body"}),a(".tooltip-test").tooltip(),a(".popover-test").popover(),a(".bs-docs-navbar").tooltip({selector:"a[data-toggle=tooltip]",container:".bs-docs-navbar .nav"}),a(".bs-docs-popover").popover(),a(".bs-docs-popover-dismiss").popover({trigger:"focus"}),a("#loading-example-btn").click(function(){var b=a(this);b.button("loading"),setTimeout(function(){b.button("reset")},3e3)})})}(jQuery);

File diff suppressed because one or more lines are too long

View File

@ -6,5 +6,6 @@
"node" : true,
"nonbsp": true,
"strict": true,
"undef" : true
"undef" : true,
"unused": true
}

View File

@ -8,5 +8,6 @@
"eqnull" : true,
"expr" : true,
"laxbreak" : true,
"unused" : true,
"validthis": true
}

View File

@ -43,7 +43,8 @@
this.targets = $([])
var self = this
var $targets = this.$body
this.$body
.find(this.selector)
.map(function () {
var $el = $(this)

View File

@ -28,14 +28,14 @@ $(function () {
var template = $('<div id="affixTarget"><ul><li>Please affix</li><li>And unaffix</li></ul></div><div id="affixAfter" style="height: 20000px; display:block;"></div>')
template.appendTo('body')
var affixer = $('#affixTarget').affix({
$('#affixTarget').affix({
offset: $('#affixTarget ul').position()
})
$('#affixTarget')
.on('affix.bs.affix', function (e) {
.on('affix.bs.affix', function () {
ok(true, 'affix event triggered')
}).on('affixed.bs.affix', function (e) {
}).on('affixed.bs.affix', function () {
ok(true,'affixed event triggered')
$('#affixTarget').remove()
$('#affixAfter').remove()

View File

@ -98,7 +98,6 @@ $(function () {
var btn1 = $(group.children()[0])
var btn2 = $(group.children()[1])
var btn3 = $(group.children()[2])
group.appendTo($('#qunit-fixture'))

View File

@ -64,7 +64,7 @@ $(function () {
var target = $('<a data-toggle="collapse" href="#test1"></a>')
.appendTo($('#qunit-fixture'))
var collapsible = $('<div id="test1"></div>')
$('<div id="test1"></div>')
.appendTo($('#qunit-fixture'))
.on('show.bs.collapse', function () {
ok(!target.hasClass('collapsed'))
@ -81,7 +81,7 @@ $(function () {
var target = $('<a data-toggle="collapse" href="#test1"></a>')
.appendTo($('#qunit-fixture'))
var collapsible = $('<div id="test1" class="in"></div>')
$('<div id="test1" class="in"></div>')
.appendTo($('#qunit-fixture'))
.on('hide.bs.collapse', function () {
ok(target.hasClass('collapsed'))
@ -101,19 +101,19 @@ $(function () {
var target1 = $('<a data-toggle="collapse" href="#body1" data-parent="#accordion"></a>')
.appendTo(accordion.find('.accordion-group').eq(0))
var collapsible1 = $('<div id="body1" class="in"></div>')
$('<div id="body1" class="in"></div>')
.appendTo(accordion.find('.accordion-group').eq(0))
var target2 = $('<a class="collapsed" data-toggle="collapse" href="#body2" data-parent="#accordion"></a>')
.appendTo(accordion.find('.accordion-group').eq(1))
var collapsible2 = $('<div id="body2"></div>')
$('<div id="body2"></div>')
.appendTo(accordion.find('.accordion-group').eq(1))
var target3 = $('<a class="collapsed" data-toggle="collapse" href="#body3" data-parent="#accordion"></a>')
.appendTo(accordion.find('.accordion-group').eq(2))
var collapsible3 = $('<div id="body3"></div>')
$('<div id="body3"></div>')
.appendTo(accordion.find('.accordion-group').eq(2))
.on('show.bs.collapse', function () {
ok(target1.hasClass('collapsed'))
@ -136,19 +136,19 @@ $(function () {
var target1 = $('<a data-toggle="collapse" href="#body1" data-parent=".accordion"></a>')
.appendTo(accordion.find('.accordion-group').eq(0))
var collapsible1 = $('<div id="body1" class="in"></div>')
$('<div id="body1" class="in"></div>')
.appendTo(accordion.find('.accordion-group').eq(0))
var target2 = $('<a class="collapsed" data-toggle="collapse" href="#body2" data-parent=".accordion"></a>')
.appendTo(accordion.find('.accordion-group').eq(1))
var collapsible2 = $('<div id="body2"></div>')
$('<div id="body2"></div>')
.appendTo(accordion.find('.accordion-group').eq(1))
var target3 = $('<a class="collapsed" data-toggle="collapse" href="#body3" data-parent=".accordion"></a>')
.appendTo(accordion.find('.accordion-group').eq(2))
var collapsible3 = $('<div id="body3"></div>')
$('<div id="body3"></div>')
.appendTo(accordion.find('.accordion-group').eq(2))
.on('show.bs.collapse', function () {
ok(target1.hasClass('collapsed'))

View File

@ -18,7 +18,6 @@ $(function () {
test('should switch active class on scroll', function () {
var sectionHTML = '<div id="masthead"></div>',
$section = $(sectionHTML).append('#qunit-fixture'),
topbarHTML = '<div class="topbar">' +
'<div class="topbar-inner">' +
'<div class="container">' +
@ -30,6 +29,7 @@ $(function () {
'</div>',
$topbar = $(topbarHTML).scrollspy()
$(sectionHTML).append('#qunit-fixture')
ok($topbar.find('.active', true))
})

View File

@ -68,7 +68,7 @@ $(function () {
test('should fire show event', function () {
stop()
var tooltip = $('<div title="tooltip title"></div>')
$('<div title="tooltip title"></div>')
.on('show.bs.tooltip', function () {
ok(true, 'show was called')
start()
@ -78,7 +78,7 @@ $(function () {
test('should fire shown event', function () {
stop()
var tooltip = $('<div title="tooltip title"></div>')
$('<div title="tooltip title"></div>')
.on('shown.bs.tooltip', function () {
ok(true, 'shown was called')
start()
@ -88,7 +88,7 @@ $(function () {
test('should not fire shown event when default prevented', function () {
stop()
var tooltip = $('<div title="tooltip title"></div>')
$('<div title="tooltip title"></div>')
.on('show.bs.tooltip', function (e) {
e.preventDefault()
ok(true, 'show was called')
@ -102,7 +102,7 @@ $(function () {
test('should fire hide event', function () {
stop()
var tooltip = $('<div title="tooltip title"></div>')
$('<div title="tooltip title"></div>')
.on('shown.bs.tooltip', function () {
$(this).tooltip('hide')
})
@ -115,7 +115,7 @@ $(function () {
test('should fire hidden event', function () {
stop()
var tooltip = $('<div title="tooltip title"></div>')
$('<div title="tooltip title"></div>')
.on('shown.bs.tooltip', function () {
$(this).tooltip('hide')
})
@ -128,7 +128,7 @@ $(function () {
test('should not fire hidden event when default prevented', function () {
stop()
var tooltip = $('<div title="tooltip title"></div>')
$('<div title="tooltip title"></div>')
.on('shown.bs.tooltip', function () {
$(this).tooltip('hide')
})
@ -272,14 +272,14 @@ $(function () {
test('should show tooltip with delegate selector on click', function () {
var div = $('<div><a href="#" rel="tooltip" title="Another tooltip"></a></div>')
var tooltip = div.appendTo('#qunit-fixture')
div.appendTo('#qunit-fixture')
.tooltip({ selector: 'a[rel=tooltip]', trigger: 'click' })
div.find('a').trigger('click')
ok($('.tooltip').is('.fade.in'), 'tooltip is faded in')
})
test('should show tooltip when toggle is called', function () {
var tooltip = $('<a href="#" rel="tooltip" title="tooltip on toggle"></a>')
$('<a href="#" rel="tooltip" title="tooltip on toggle"></a>')
.appendTo('#qunit-fixture')
.tooltip({trigger: 'manual'})
.tooltip('toggle')
@ -298,8 +298,8 @@ $(function () {
test('should place tooltip inside window', function () {
var container = $('<div />').appendTo('body')
.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>')
.css({position: 'absolute', width: 200, height: 200, bottom: 0, left: 0})
$('<a href="#" title="Very very very very very very very very long tooltip">Hover me</a>')
.css({position: 'absolute', top: 0, left: 0})
.appendTo(container)
.tooltip({placement: 'top', animate: false})

View File

@ -195,7 +195,6 @@
}
Tooltip.prototype.applyPlacement = function (offset, placement) {
var replace
var $tip = this.tip()
var width = $tip[0].offsetWidth
var height = $tip[0].offsetHeight