bootstrap-sass 3.3.4.1 → 3.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.travis.yml +8 -12
- data/CHANGELOG.md +26 -0
- data/Gemfile +1 -4
- data/LICENSE +2 -1
- data/README.md +80 -74
- data/Rakefile +46 -11
- data/assets/javascripts/bootstrap.js +441 -178
- data/assets/javascripts/bootstrap.min.js +4 -5
- data/assets/javascripts/bootstrap/affix.js +8 -6
- data/assets/javascripts/bootstrap/alert.js +6 -5
- data/assets/javascripts/bootstrap/button.js +24 -15
- data/assets/javascripts/bootstrap/carousel.js +16 -7
- data/assets/javascripts/bootstrap/collapse.js +7 -6
- data/assets/javascripts/bootstrap/dropdown.js +49 -45
- data/assets/javascripts/bootstrap/modal.js +47 -28
- data/assets/javascripts/bootstrap/popover.js +25 -10
- data/assets/javascripts/bootstrap/scrollspy.js +4 -4
- data/assets/javascripts/bootstrap/tab.js +13 -11
- data/assets/javascripts/bootstrap/tooltip.js +232 -31
- data/assets/javascripts/bootstrap/transition.js +5 -5
- data/assets/stylesheets/_bootstrap-mincer.scss +2 -2
- data/assets/stylesheets/_bootstrap.scss +6 -0
- data/assets/stylesheets/bootstrap/_alerts.scss +3 -3
- data/assets/stylesheets/bootstrap/_badges.scss +3 -3
- data/assets/stylesheets/bootstrap/_breadcrumbs.scss +3 -1
- data/assets/stylesheets/bootstrap/_button-groups.scss +9 -8
- data/assets/stylesheets/bootstrap/_buttons.scss +17 -9
- data/assets/stylesheets/bootstrap/_carousel.scss +34 -32
- data/assets/stylesheets/bootstrap/_close.scss +1 -0
- data/assets/stylesheets/bootstrap/_code.scss +3 -3
- data/assets/stylesheets/bootstrap/_component-animations.scss +1 -0
- data/assets/stylesheets/bootstrap/_dropdowns.scss +22 -23
- data/assets/stylesheets/bootstrap/_forms.scss +101 -72
- data/assets/stylesheets/bootstrap/_glyphicons.scss +15 -13
- data/assets/stylesheets/bootstrap/_grid.scss +10 -0
- data/assets/stylesheets/bootstrap/_input-groups.scss +10 -5
- data/assets/stylesheets/bootstrap/_jumbotron.scss +8 -4
- data/assets/stylesheets/bootstrap/_labels.scss +1 -1
- data/assets/stylesheets/bootstrap/_list-group.scss +30 -26
- data/assets/stylesheets/bootstrap/_media.scss +6 -1
- data/assets/stylesheets/bootstrap/_mixins.scss +1 -0
- data/assets/stylesheets/bootstrap/_modals.scss +8 -8
- data/assets/stylesheets/bootstrap/_navbar.scss +75 -81
- data/assets/stylesheets/bootstrap/_navs.scss +4 -4
- data/assets/stylesheets/bootstrap/_normalize.scss +13 -13
- data/assets/stylesheets/bootstrap/_pager.scss +2 -2
- data/assets/stylesheets/bootstrap/_pagination.scss +15 -17
- data/assets/stylesheets/bootstrap/_panels.scss +11 -5
- data/assets/stylesheets/bootstrap/_popovers.scss +50 -59
- data/assets/stylesheets/bootstrap/_print.scss +90 -98
- data/assets/stylesheets/bootstrap/_progress-bars.scss +3 -3
- data/assets/stylesheets/bootstrap/_responsive-embed.scss +2 -2
- data/assets/stylesheets/bootstrap/_responsive-utilities.scss +7 -5
- data/assets/stylesheets/bootstrap/_scaffolding.scss +8 -9
- data/assets/stylesheets/bootstrap/_tables.scss +23 -23
- data/assets/stylesheets/bootstrap/_theme.scss +42 -20
- data/assets/stylesheets/bootstrap/_thumbnails.scss +1 -1
- data/assets/stylesheets/bootstrap/_tooltip.scss +42 -32
- data/assets/stylesheets/bootstrap/_type.scss +11 -11
- data/assets/stylesheets/bootstrap/_variables.scss +16 -8
- data/assets/stylesheets/bootstrap/_wells.scss +2 -2
- data/assets/stylesheets/bootstrap/mixins/_alerts.scss +2 -1
- data/assets/stylesheets/bootstrap/mixins/_background-variant.scss +2 -1
- data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +4 -4
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +20 -11
- data/assets/stylesheets/bootstrap/mixins/_center-block.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_clearfix.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +4 -4
- data/assets/stylesheets/bootstrap/mixins/_gradients.scss +6 -8
- data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +2 -2
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +8 -8
- data/assets/stylesheets/bootstrap/mixins/_hide-text.scss +2 -2
- data/assets/stylesheets/bootstrap/mixins/_image.scss +5 -10
- data/assets/stylesheets/bootstrap/mixins/_list-group.scss +3 -2
- data/assets/stylesheets/bootstrap/mixins/_opacity.scss +2 -3
- data/assets/stylesheets/bootstrap/mixins/_pagination.scss +2 -1
- data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +18 -0
- data/assets/stylesheets/bootstrap/mixins/_resize.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_responsive-visibility.scss +1 -5
- data/assets/stylesheets/bootstrap/mixins/_tab-focus.scss +3 -3
- data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +2 -1
- data/assets/stylesheets/bootstrap/mixins/_vendor-prefixes.scss +3 -3
- data/bootstrap-sass.gemspec +10 -9
- data/bower.json +5 -9
- data/composer.json +2 -2
- data/eyeglass-exports.js +7 -0
- data/lib/bootstrap-sass.rb +18 -11
- data/lib/bootstrap-sass/engine.rb +6 -1
- data/lib/bootstrap-sass/version.rb +2 -2
- data/package-lock.json +1611 -0
- data/package.json +20 -6
- data/sache.json +1 -1
- data/tasks/converter/less_conversion.rb +20 -9
- data/tasks/converter/network.rb +2 -2
- data/templates/project/_bootstrap-variables.sass +17 -9
- data/test/compilation_test.rb +24 -12
- data/test/dummy_rails/config/application.rb +2 -1
- data/test/dummy_rails/config/boot.rb +1 -1
- data/test/dummy_sass_only/Gemfile +1 -1
- data/test/dummy_sass_only/compile.rb +14 -7
- data/test/dummy_sass_only/import_all.scss +2 -0
- data/test/gemfiles/default.gemfile +3 -0
- data/test/node_mincer_test.rb +2 -3
- data/test/node_sass_compile_test.sh +4 -3
- data/test/sass_test.rb +10 -7
- data/test/sprockets_rails_test.rb +12 -8
- data/test/support/dummy_rails_integration.rb +1 -1
- data/test/support/reporting.rb +10 -0
- data/test/test_helper.rb +3 -2
- metadata +38 -29
- data/test/compass_test.rb +0 -9
- data/test/dummy_sass_only/import_all.sass +0 -2
- data/test/gemfiles/sass_3_2.gemfile +0 -6
- data/test/gemfiles/sass_3_3.gemfile +0 -6
- data/test/gemfiles/sass_3_4.gemfile +0 -7
- data/test/gemfiles/sass_head.gemfile +0 -6
@@ -1,8 +1,8 @@
|
|
1
1
|
/* ========================================================================
|
2
|
-
* Bootstrap: popover.js v3.
|
3
|
-
*
|
2
|
+
* Bootstrap: popover.js v3.4.1
|
3
|
+
* https://getbootstrap.com/docs/3.4/javascript/#popovers
|
4
4
|
* ========================================================================
|
5
|
-
* Copyright 2011-
|
5
|
+
* Copyright 2011-2019 Twitter, Inc.
|
6
6
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
7
7
|
* ======================================================================== */
|
8
8
|
|
@@ -19,7 +19,7 @@
|
|
19
19
|
|
20
20
|
if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
|
21
21
|
|
22
|
-
Popover.VERSION = '3.
|
22
|
+
Popover.VERSION = '3.4.1'
|
23
23
|
|
24
24
|
Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
|
25
25
|
placement: 'right',
|
@@ -45,10 +45,25 @@
|
|
45
45
|
var title = this.getTitle()
|
46
46
|
var content = this.getContent()
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
48
|
+
if (this.options.html) {
|
49
|
+
var typeContent = typeof content
|
50
|
+
|
51
|
+
if (this.options.sanitize) {
|
52
|
+
title = this.sanitizeHtml(title)
|
53
|
+
|
54
|
+
if (typeContent === 'string') {
|
55
|
+
content = this.sanitizeHtml(content)
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
$tip.find('.popover-title').html(title)
|
60
|
+
$tip.find('.popover-content').children().detach().end()[
|
61
|
+
typeContent === 'string' ? 'html' : 'append'
|
62
|
+
](content)
|
63
|
+
} else {
|
64
|
+
$tip.find('.popover-title').text(title)
|
65
|
+
$tip.find('.popover-content').children().detach().end().text(content)
|
66
|
+
}
|
52
67
|
|
53
68
|
$tip.removeClass('fade top bottom left right in')
|
54
69
|
|
@@ -67,8 +82,8 @@
|
|
67
82
|
|
68
83
|
return $e.attr('data-content')
|
69
84
|
|| (typeof o.content == 'function' ?
|
70
|
-
|
71
|
-
|
85
|
+
o.content.call($e[0]) :
|
86
|
+
o.content)
|
72
87
|
}
|
73
88
|
|
74
89
|
Popover.prototype.arrow = function () {
|
@@ -1,8 +1,8 @@
|
|
1
1
|
/* ========================================================================
|
2
|
-
* Bootstrap: scrollspy.js v3.
|
3
|
-
*
|
2
|
+
* Bootstrap: scrollspy.js v3.4.1
|
3
|
+
* https://getbootstrap.com/docs/3.4/javascript/#scrollspy
|
4
4
|
* ========================================================================
|
5
|
-
* Copyright 2011-
|
5
|
+
* Copyright 2011-2019 Twitter, Inc.
|
6
6
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
7
7
|
* ======================================================================== */
|
8
8
|
|
@@ -28,7 +28,7 @@
|
|
28
28
|
this.process()
|
29
29
|
}
|
30
30
|
|
31
|
-
ScrollSpy.VERSION = '3.
|
31
|
+
ScrollSpy.VERSION = '3.4.1'
|
32
32
|
|
33
33
|
ScrollSpy.DEFAULTS = {
|
34
34
|
offset: 10
|
@@ -1,8 +1,8 @@
|
|
1
1
|
/* ========================================================================
|
2
|
-
* Bootstrap: tab.js v3.
|
3
|
-
*
|
2
|
+
* Bootstrap: tab.js v3.4.1
|
3
|
+
* https://getbootstrap.com/docs/3.4/javascript/#tabs
|
4
4
|
* ========================================================================
|
5
|
-
* Copyright 2011-
|
5
|
+
* Copyright 2011-2019 Twitter, Inc.
|
6
6
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
7
7
|
* ======================================================================== */
|
8
8
|
|
@@ -14,10 +14,12 @@
|
|
14
14
|
// ====================
|
15
15
|
|
16
16
|
var Tab = function (element) {
|
17
|
+
// jscs:disable requireDollarBeforejQueryAssignment
|
17
18
|
this.element = $(element)
|
19
|
+
// jscs:enable requireDollarBeforejQueryAssignment
|
18
20
|
}
|
19
21
|
|
20
|
-
Tab.VERSION = '3.
|
22
|
+
Tab.VERSION = '3.4.1'
|
21
23
|
|
22
24
|
Tab.TRANSITION_DURATION = 150
|
23
25
|
|
@@ -46,7 +48,7 @@
|
|
46
48
|
|
47
49
|
if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
|
48
50
|
|
49
|
-
var $target = $(selector)
|
51
|
+
var $target = $(document).find(selector)
|
50
52
|
|
51
53
|
this.activate($this.closest('li'), $ul)
|
52
54
|
this.activate($target, $target.parent(), function () {
|
@@ -65,21 +67,21 @@
|
|
65
67
|
var $active = container.find('> .active')
|
66
68
|
var transition = callback
|
67
69
|
&& $.support.transition
|
68
|
-
&& (
|
70
|
+
&& ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)
|
69
71
|
|
70
72
|
function next() {
|
71
73
|
$active
|
72
74
|
.removeClass('active')
|
73
75
|
.find('> .dropdown-menu > .active')
|
74
|
-
|
76
|
+
.removeClass('active')
|
75
77
|
.end()
|
76
78
|
.find('[data-toggle="tab"]')
|
77
|
-
|
79
|
+
.attr('aria-expanded', false)
|
78
80
|
|
79
81
|
element
|
80
82
|
.addClass('active')
|
81
83
|
.find('[data-toggle="tab"]')
|
82
|
-
|
84
|
+
.attr('aria-expanded', true)
|
83
85
|
|
84
86
|
if (transition) {
|
85
87
|
element[0].offsetWidth // reflow for transition
|
@@ -91,10 +93,10 @@
|
|
91
93
|
if (element.parent('.dropdown-menu').length) {
|
92
94
|
element
|
93
95
|
.closest('li.dropdown')
|
94
|
-
|
96
|
+
.addClass('active')
|
95
97
|
.end()
|
96
98
|
.find('[data-toggle="tab"]')
|
97
|
-
|
99
|
+
.attr('aria-expanded', true)
|
98
100
|
}
|
99
101
|
|
100
102
|
callback && callback()
|
@@ -1,16 +1,146 @@
|
|
1
1
|
/* ========================================================================
|
2
|
-
* Bootstrap: tooltip.js v3.
|
3
|
-
*
|
2
|
+
* Bootstrap: tooltip.js v3.4.1
|
3
|
+
* https://getbootstrap.com/docs/3.4/javascript/#tooltip
|
4
4
|
* Inspired by the original jQuery.tipsy by Jason Frame
|
5
5
|
* ========================================================================
|
6
|
-
* Copyright 2011-
|
6
|
+
* Copyright 2011-2019 Twitter, Inc.
|
7
7
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
8
8
|
* ======================================================================== */
|
9
9
|
|
10
|
-
|
11
10
|
+function ($) {
|
12
11
|
'use strict';
|
13
12
|
|
13
|
+
var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']
|
14
|
+
|
15
|
+
var uriAttrs = [
|
16
|
+
'background',
|
17
|
+
'cite',
|
18
|
+
'href',
|
19
|
+
'itemtype',
|
20
|
+
'longdesc',
|
21
|
+
'poster',
|
22
|
+
'src',
|
23
|
+
'xlink:href'
|
24
|
+
]
|
25
|
+
|
26
|
+
var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i
|
27
|
+
|
28
|
+
var DefaultWhitelist = {
|
29
|
+
// Global attributes allowed on any supplied element below.
|
30
|
+
'*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
|
31
|
+
a: ['target', 'href', 'title', 'rel'],
|
32
|
+
area: [],
|
33
|
+
b: [],
|
34
|
+
br: [],
|
35
|
+
col: [],
|
36
|
+
code: [],
|
37
|
+
div: [],
|
38
|
+
em: [],
|
39
|
+
hr: [],
|
40
|
+
h1: [],
|
41
|
+
h2: [],
|
42
|
+
h3: [],
|
43
|
+
h4: [],
|
44
|
+
h5: [],
|
45
|
+
h6: [],
|
46
|
+
i: [],
|
47
|
+
img: ['src', 'alt', 'title', 'width', 'height'],
|
48
|
+
li: [],
|
49
|
+
ol: [],
|
50
|
+
p: [],
|
51
|
+
pre: [],
|
52
|
+
s: [],
|
53
|
+
small: [],
|
54
|
+
span: [],
|
55
|
+
sub: [],
|
56
|
+
sup: [],
|
57
|
+
strong: [],
|
58
|
+
u: [],
|
59
|
+
ul: []
|
60
|
+
}
|
61
|
+
|
62
|
+
/**
|
63
|
+
* A pattern that recognizes a commonly useful subset of URLs that are safe.
|
64
|
+
*
|
65
|
+
* Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
|
66
|
+
*/
|
67
|
+
var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi
|
68
|
+
|
69
|
+
/**
|
70
|
+
* A pattern that matches safe data URLs. Only matches image, video and audio types.
|
71
|
+
*
|
72
|
+
* Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
|
73
|
+
*/
|
74
|
+
var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i
|
75
|
+
|
76
|
+
function allowedAttribute(attr, allowedAttributeList) {
|
77
|
+
var attrName = attr.nodeName.toLowerCase()
|
78
|
+
|
79
|
+
if ($.inArray(attrName, allowedAttributeList) !== -1) {
|
80
|
+
if ($.inArray(attrName, uriAttrs) !== -1) {
|
81
|
+
return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN))
|
82
|
+
}
|
83
|
+
|
84
|
+
return true
|
85
|
+
}
|
86
|
+
|
87
|
+
var regExp = $(allowedAttributeList).filter(function (index, value) {
|
88
|
+
return value instanceof RegExp
|
89
|
+
})
|
90
|
+
|
91
|
+
// Check if a regular expression validates the attribute.
|
92
|
+
for (var i = 0, l = regExp.length; i < l; i++) {
|
93
|
+
if (attrName.match(regExp[i])) {
|
94
|
+
return true
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
return false
|
99
|
+
}
|
100
|
+
|
101
|
+
function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
|
102
|
+
if (unsafeHtml.length === 0) {
|
103
|
+
return unsafeHtml
|
104
|
+
}
|
105
|
+
|
106
|
+
if (sanitizeFn && typeof sanitizeFn === 'function') {
|
107
|
+
return sanitizeFn(unsafeHtml)
|
108
|
+
}
|
109
|
+
|
110
|
+
// IE 8 and below don't support createHTMLDocument
|
111
|
+
if (!document.implementation || !document.implementation.createHTMLDocument) {
|
112
|
+
return unsafeHtml
|
113
|
+
}
|
114
|
+
|
115
|
+
var createdDocument = document.implementation.createHTMLDocument('sanitization')
|
116
|
+
createdDocument.body.innerHTML = unsafeHtml
|
117
|
+
|
118
|
+
var whitelistKeys = $.map(whiteList, function (el, i) { return i })
|
119
|
+
var elements = $(createdDocument.body).find('*')
|
120
|
+
|
121
|
+
for (var i = 0, len = elements.length; i < len; i++) {
|
122
|
+
var el = elements[i]
|
123
|
+
var elName = el.nodeName.toLowerCase()
|
124
|
+
|
125
|
+
if ($.inArray(elName, whitelistKeys) === -1) {
|
126
|
+
el.parentNode.removeChild(el)
|
127
|
+
|
128
|
+
continue
|
129
|
+
}
|
130
|
+
|
131
|
+
var attributeList = $.map(el.attributes, function (el) { return el })
|
132
|
+
var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || [])
|
133
|
+
|
134
|
+
for (var j = 0, len2 = attributeList.length; j < len2; j++) {
|
135
|
+
if (!allowedAttribute(attributeList[j], whitelistedAttributes)) {
|
136
|
+
el.removeAttribute(attributeList[j].nodeName)
|
137
|
+
}
|
138
|
+
}
|
139
|
+
}
|
140
|
+
|
141
|
+
return createdDocument.body.innerHTML
|
142
|
+
}
|
143
|
+
|
14
144
|
// TOOLTIP PUBLIC CLASS DEFINITION
|
15
145
|
// ===============================
|
16
146
|
|
@@ -21,11 +151,12 @@
|
|
21
151
|
this.timeout = null
|
22
152
|
this.hoverState = null
|
23
153
|
this.$element = null
|
154
|
+
this.inState = null
|
24
155
|
|
25
156
|
this.init('tooltip', element, options)
|
26
157
|
}
|
27
158
|
|
28
|
-
Tooltip.VERSION = '3.
|
159
|
+
Tooltip.VERSION = '3.4.1'
|
29
160
|
|
30
161
|
Tooltip.TRANSITION_DURATION = 150
|
31
162
|
|
@@ -42,7 +173,10 @@
|
|
42
173
|
viewport: {
|
43
174
|
selector: 'body',
|
44
175
|
padding: 0
|
45
|
-
}
|
176
|
+
},
|
177
|
+
sanitize : true,
|
178
|
+
sanitizeFn : null,
|
179
|
+
whiteList : DefaultWhitelist
|
46
180
|
}
|
47
181
|
|
48
182
|
Tooltip.prototype.init = function (type, element, options) {
|
@@ -50,7 +184,8 @@
|
|
50
184
|
this.type = type
|
51
185
|
this.$element = $(element)
|
52
186
|
this.options = this.getOptions(options)
|
53
|
-
this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport)
|
187
|
+
this.$viewport = this.options.viewport && $(document).find($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
|
188
|
+
this.inState = { click: false, hover: false, focus: false }
|
54
189
|
|
55
190
|
if (this.$element[0] instanceof document.constructor && !this.options.selector) {
|
56
191
|
throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
|
@@ -82,7 +217,15 @@
|
|
82
217
|
}
|
83
218
|
|
84
219
|
Tooltip.prototype.getOptions = function (options) {
|
85
|
-
|
220
|
+
var dataAttributes = this.$element.data()
|
221
|
+
|
222
|
+
for (var dataAttr in dataAttributes) {
|
223
|
+
if (dataAttributes.hasOwnProperty(dataAttr) && $.inArray(dataAttr, DISALLOWED_ATTRIBUTES) !== -1) {
|
224
|
+
delete dataAttributes[dataAttr]
|
225
|
+
}
|
226
|
+
}
|
227
|
+
|
228
|
+
options = $.extend({}, this.getDefaults(), dataAttributes, options)
|
86
229
|
|
87
230
|
if (options.delay && typeof options.delay == 'number') {
|
88
231
|
options.delay = {
|
@@ -91,6 +234,10 @@
|
|
91
234
|
}
|
92
235
|
}
|
93
236
|
|
237
|
+
if (options.sanitize) {
|
238
|
+
options.template = sanitizeHtml(options.template, options.whiteList, options.sanitizeFn)
|
239
|
+
}
|
240
|
+
|
94
241
|
return options
|
95
242
|
}
|
96
243
|
|
@@ -109,16 +256,20 @@
|
|
109
256
|
var self = obj instanceof this.constructor ?
|
110
257
|
obj : $(obj.currentTarget).data('bs.' + this.type)
|
111
258
|
|
112
|
-
if (self && self.$tip && self.$tip.is(':visible')) {
|
113
|
-
self.hoverState = 'in'
|
114
|
-
return
|
115
|
-
}
|
116
|
-
|
117
259
|
if (!self) {
|
118
260
|
self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
|
119
261
|
$(obj.currentTarget).data('bs.' + this.type, self)
|
120
262
|
}
|
121
263
|
|
264
|
+
if (obj instanceof $.Event) {
|
265
|
+
self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true
|
266
|
+
}
|
267
|
+
|
268
|
+
if (self.tip().hasClass('in') || self.hoverState == 'in') {
|
269
|
+
self.hoverState = 'in'
|
270
|
+
return
|
271
|
+
}
|
272
|
+
|
122
273
|
clearTimeout(self.timeout)
|
123
274
|
|
124
275
|
self.hoverState = 'in'
|
@@ -130,6 +281,14 @@
|
|
130
281
|
}, self.options.delay.show)
|
131
282
|
}
|
132
283
|
|
284
|
+
Tooltip.prototype.isInStateTrue = function () {
|
285
|
+
for (var key in this.inState) {
|
286
|
+
if (this.inState[key]) return true
|
287
|
+
}
|
288
|
+
|
289
|
+
return false
|
290
|
+
}
|
291
|
+
|
133
292
|
Tooltip.prototype.leave = function (obj) {
|
134
293
|
var self = obj instanceof this.constructor ?
|
135
294
|
obj : $(obj.currentTarget).data('bs.' + this.type)
|
@@ -139,6 +298,12 @@
|
|
139
298
|
$(obj.currentTarget).data('bs.' + this.type, self)
|
140
299
|
}
|
141
300
|
|
301
|
+
if (obj instanceof $.Event) {
|
302
|
+
self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false
|
303
|
+
}
|
304
|
+
|
305
|
+
if (self.isInStateTrue()) return
|
306
|
+
|
142
307
|
clearTimeout(self.timeout)
|
143
308
|
|
144
309
|
self.hoverState = 'out'
|
@@ -184,7 +349,8 @@
|
|
184
349
|
.addClass(placement)
|
185
350
|
.data('bs.' + this.type, this)
|
186
351
|
|
187
|
-
this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
|
352
|
+
this.options.container ? $tip.appendTo($(document).find(this.options.container)) : $tip.insertAfter(this.$element)
|
353
|
+
this.$element.trigger('inserted.bs.' + this.type)
|
188
354
|
|
189
355
|
var pos = this.getPosition()
|
190
356
|
var actualWidth = $tip[0].offsetWidth
|
@@ -192,13 +358,12 @@
|
|
192
358
|
|
193
359
|
if (autoPlace) {
|
194
360
|
var orgPlacement = placement
|
195
|
-
var
|
196
|
-
var containerDim = this.getPosition($container)
|
361
|
+
var viewportDim = this.getPosition(this.$viewport)
|
197
362
|
|
198
|
-
placement = placement == 'bottom' && pos.bottom + actualHeight >
|
199
|
-
placement == 'top' && pos.top - actualHeight <
|
200
|
-
placement == 'right' && pos.right + actualWidth >
|
201
|
-
placement == 'left' && pos.left - actualWidth <
|
363
|
+
placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' :
|
364
|
+
placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' :
|
365
|
+
placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' :
|
366
|
+
placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' :
|
202
367
|
placement
|
203
368
|
|
204
369
|
$tip
|
@@ -239,8 +404,8 @@
|
|
239
404
|
if (isNaN(marginTop)) marginTop = 0
|
240
405
|
if (isNaN(marginLeft)) marginLeft = 0
|
241
406
|
|
242
|
-
offset.top
|
243
|
-
offset.left
|
407
|
+
offset.top += marginTop
|
408
|
+
offset.left += marginLeft
|
244
409
|
|
245
410
|
// $.fn.offset doesn't round pixel values
|
246
411
|
// so we use setOffset directly with our own function B-0
|
@@ -286,7 +451,16 @@
|
|
286
451
|
var $tip = this.tip()
|
287
452
|
var title = this.getTitle()
|
288
453
|
|
289
|
-
|
454
|
+
if (this.options.html) {
|
455
|
+
if (this.options.sanitize) {
|
456
|
+
title = sanitizeHtml(title, this.options.whiteList, this.options.sanitizeFn)
|
457
|
+
}
|
458
|
+
|
459
|
+
$tip.find('.tooltip-inner').html(title)
|
460
|
+
} else {
|
461
|
+
$tip.find('.tooltip-inner').text(title)
|
462
|
+
}
|
463
|
+
|
290
464
|
$tip.removeClass('fade in top bottom left right')
|
291
465
|
}
|
292
466
|
|
@@ -297,9 +471,11 @@
|
|
297
471
|
|
298
472
|
function complete() {
|
299
473
|
if (that.hoverState != 'in') $tip.detach()
|
300
|
-
that.$element
|
301
|
-
|
302
|
-
|
474
|
+
if (that.$element) { // TODO: Check whether guarding this code with this `if` is really necessary.
|
475
|
+
that.$element
|
476
|
+
.removeAttr('aria-describedby')
|
477
|
+
.trigger('hidden.bs.' + that.type)
|
478
|
+
}
|
303
479
|
callback && callback()
|
304
480
|
}
|
305
481
|
|
@@ -322,7 +498,7 @@
|
|
322
498
|
|
323
499
|
Tooltip.prototype.fixTitle = function () {
|
324
500
|
var $e = this.$element
|
325
|
-
if ($e.attr('title') || typeof
|
501
|
+
if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {
|
326
502
|
$e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
|
327
503
|
}
|
328
504
|
}
|
@@ -342,7 +518,10 @@
|
|
342
518
|
// width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
|
343
519
|
elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
|
344
520
|
}
|
345
|
-
var
|
521
|
+
var isSvg = window.SVGElement && el instanceof window.SVGElement
|
522
|
+
// Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3.
|
523
|
+
// See https://github.com/twbs/bootstrap/issues/20280
|
524
|
+
var elOffset = isBody ? { top: 0, left: 0 } : (isSvg ? null : $element.offset())
|
346
525
|
var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
|
347
526
|
var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
|
348
527
|
|
@@ -377,7 +556,7 @@
|
|
377
556
|
var rightEdgeOffset = pos.left + viewportPadding + actualWidth
|
378
557
|
if (leftEdgeOffset < viewportDimensions.left) { // left overflow
|
379
558
|
delta.left = viewportDimensions.left - leftEdgeOffset
|
380
|
-
} else if (rightEdgeOffset > viewportDimensions.
|
559
|
+
} else if (rightEdgeOffset > viewportDimensions.right) { // right overflow
|
381
560
|
delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
|
382
561
|
}
|
383
562
|
}
|
@@ -403,7 +582,13 @@
|
|
403
582
|
}
|
404
583
|
|
405
584
|
Tooltip.prototype.tip = function () {
|
406
|
-
|
585
|
+
if (!this.$tip) {
|
586
|
+
this.$tip = $(this.options.template)
|
587
|
+
if (this.$tip.length != 1) {
|
588
|
+
throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!')
|
589
|
+
}
|
590
|
+
}
|
591
|
+
return this.$tip
|
407
592
|
}
|
408
593
|
|
409
594
|
Tooltip.prototype.arrow = function () {
|
@@ -432,7 +617,13 @@
|
|
432
617
|
}
|
433
618
|
}
|
434
619
|
|
435
|
-
|
620
|
+
if (e) {
|
621
|
+
self.inState.click = !self.inState.click
|
622
|
+
if (self.isInStateTrue()) self.enter(self)
|
623
|
+
else self.leave(self)
|
624
|
+
} else {
|
625
|
+
self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
|
626
|
+
}
|
436
627
|
}
|
437
628
|
|
438
629
|
Tooltip.prototype.destroy = function () {
|
@@ -440,9 +631,19 @@
|
|
440
631
|
clearTimeout(this.timeout)
|
441
632
|
this.hide(function () {
|
442
633
|
that.$element.off('.' + that.type).removeData('bs.' + that.type)
|
634
|
+
if (that.$tip) {
|
635
|
+
that.$tip.detach()
|
636
|
+
}
|
637
|
+
that.$tip = null
|
638
|
+
that.$arrow = null
|
639
|
+
that.$viewport = null
|
640
|
+
that.$element = null
|
443
641
|
})
|
444
642
|
}
|
445
643
|
|
644
|
+
Tooltip.prototype.sanitizeHtml = function (unsafeHtml) {
|
645
|
+
return sanitizeHtml(unsafeHtml, this.options.whiteList, this.options.sanitizeFn)
|
646
|
+
}
|
446
647
|
|
447
648
|
// TOOLTIP PLUGIN DEFINITION
|
448
649
|
// =========================
|