You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>If you want to add new values to this default <code>whiteList</code> you can do the following:</p>
116
+
117
+
{% highlight js %}
118
+
var myDefaultWhiteList = $.fn.tooltip.Constructor.DEFAULTS.whiteList
119
+
120
+
// To allow table elements
121
+
myDefaultWhiteList.table = []
122
+
123
+
// To allow td elements and data-option attributes on td elements
124
+
myDefaultWhiteList.td = ['data-option']
125
+
126
+
// You can push your custom regex to validate your attributes.
127
+
// Be careful about your regular expressions being too lax
128
+
var myCustomRegex = /^data-my-app-[\w-]+/
129
+
myDefaultWhiteList['*'].push(myCustomRegex)
130
+
{% endhighlight %}
131
+
132
+
<p>If you want to bypass our sanitizer because you prefer to use a dedicated library, for example <ahref="https://www.npmjs.com/package/dompurify">DOMPurify</a>, you should do the following:</p>
<h4>Browsers without <code>document.implementation.createHTMLDocument</code></h4>
144
+
<p>In case of browsers that don't support <code>document.implementation.createHTMLDocument</code>, like Internet Explorer 8, the built-in sanitize function returns the HTML as is.</p>
145
+
<p>If you want to perform sanitization in this case, please specify <code>sanitizeFn</code> and use an external library like <ahref="https://www.npmjs.com/package/dompurify">DOMPurify</a>.</p>
146
+
</div>
147
+
73
148
<h2id="js-version-nums">Version numbers</h2>
74
149
<p>The version of each of Bootstrap's jQuery plugins can be accessed via the <code>VERSION</code> property of the plugin's constructor. For example, for the tooltip plugin:</p>
<p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-animation=""</code>.</p>
<p>Note that for security reasons the <code>sanitize</code>, <code>sanitizeFn</code> and <code>whiteList</code> options cannot be supplied using data attributes.</p>
<p>Keeps the popover within the bounds of this element. Example: <code>viewport: '#viewport'</code> or <code>{ "selector": "#viewport", "padding": 0 }</code></p>
240
245
<p>If a function is given, it is called with the triggering element DOM node as its only argument. The <code>this</code> context is set to the popover instance.</p>
241
246
</td>
242
-
</tr>
247
+
</tr>
248
+
<tr>
249
+
<td>sanitize</td>
250
+
<td>boolean</td>
251
+
<td>true</td>
252
+
<td>Enable or disable the sanitization. If activated <code>'template'</code>, <code>'content'</code> and <code>'title'</code> options will be sanitized.</td>
253
+
</tr>
254
+
<tr>
255
+
<td>whiteList</td>
256
+
<td>object</td>
257
+
<td><ahref="#js-sanitizer">Default value</a></td>
258
+
<td>Object which contains allowed attributes and tags</td>
259
+
</tr>
260
+
<tr>
261
+
<td>sanitizeFn</td>
262
+
<td>null | function</td>
263
+
<td>null</td>
264
+
<td>Here you can supply your own sanitize function. This can be useful if you prefer to use a dedicated library to perform sanitization.</td>
Copy file name to clipboardExpand all lines: docs/_includes/js/tooltips.html
+23
Original file line number
Diff line number
Diff line change
@@ -115,6 +115,11 @@ <h4>Tooltips on disabled elements require wrapper elements</h4>
115
115
116
116
<h3id="tooltips-options">Options</h3>
117
117
<p>Options can be passed via data attributes or JavaScript. For data attributes, append the option name to <code>data-</code>, as in <code>data-animation=""</code>.</p>
<p>Note that for security reasons the <code>sanitize</code>, <code>sanitizeFn</code> and <code>whiteList</code> options cannot be supplied using data attributes.</p>
<p>If a function is given, it is called with the triggering element DOM node as its only argument. The <code>this</code> context is set to the tooltip instance.</p>
207
212
</td>
208
213
</tr>
214
+
<tr>
215
+
<td>sanitize</td>
216
+
<td>boolean</td>
217
+
<td>true</td>
218
+
<td>Enable or disable the sanitization. If activated <code>'template'</code>, <code>'content'</code> and <code>'title'</code> options will be sanitized.</td>
219
+
</tr>
220
+
<tr>
221
+
<td>whiteList</td>
222
+
<td>object</td>
223
+
<td><ahref="#js-sanitizer">Default value</a></td>
224
+
<td>Object which contains allowed attributes and tags</td>
225
+
</tr>
226
+
<tr>
227
+
<td>sanitizeFn</td>
228
+
<td>null | function</td>
229
+
<td>null</td>
230
+
<td>Here you can supply your own sanitize function. This can be useful if you prefer to use a dedicated library to perform sanitization.</td>
0 commit comments