Skip to content

Commit d6b8501

Browse files
committed
ES5 fixes.
1 parent 2c8abb9 commit d6b8501

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

js/tooltip.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
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
7575

7676
function allowedAttribute(attr, allowedAttributeList) {
77-
const attrName = attr.nodeName.toLowerCase()
77+
var attrName = attr.nodeName.toLowerCase()
7878

7979
if ($.inArray(attrName, allowedAttributeList) !== -1) {
8080
if ($.inArray(attrName, uriAttrs) !== -1) {
@@ -115,7 +115,7 @@
115115
var createdDocument = document.implementation.createHTMLDocument('sanitization')
116116
createdDocument.body.innerHTML = unsafeHtml
117117

118-
var whitelistKeys = Object.keys(whiteList)
118+
var whitelistKeys = $.map(whiteList, function (el, i) { return i })
119119
var elements = $(createdDocument.body).find('*')
120120

121121
for (var i = 0, len = elements.length; i < len; i++) {
@@ -131,11 +131,11 @@
131131
var attributeList = $.map(el.attributes, function (el) { return el })
132132
var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || [])
133133

134-
attributeList.forEach((attr) => {
135-
if (!allowedAttribute(attr, whitelistedAttributes)) {
136-
el.removeAttribute(attr.nodeName)
134+
for (var j = 0, len2 = attributeList.length; j < len2; j++) {
135+
if (!allowedAttribute(attributeList[j], whitelistedAttributes)) {
136+
el.removeAttribute(attributeList[j].nodeName)
137137
}
138-
})
138+
}
139139
}
140140

141141
return createdDocument.body.innerHTML
@@ -217,7 +217,7 @@
217217
}
218218

219219
Tooltip.prototype.getOptions = function (options) {
220-
const dataAttributes = this.$element.data()
220+
var dataAttributes = this.$element.data()
221221

222222
for (var dataAttr in dataAttributes) {
223223
if (dataAttributes.hasOwnProperty(dataAttr) && $.inArray(dataAttr, DISALLOWED_ATTRIBUTES) !== -1) {
@@ -235,7 +235,7 @@
235235
}
236236

237237
if (options.sanitize) {
238-
config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn)
238+
options.template = sanitizeHtml(options.template, options.whiteList, options.sanitizeFn)
239239
}
240240

241241
return options

0 commit comments

Comments
 (0)