|
74 | 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 | 75 |
|
76 | 76 | function allowedAttribute(attr, allowedAttributeList) {
|
77 |
| - const attrName = attr.nodeName.toLowerCase() |
| 77 | + var attrName = attr.nodeName.toLowerCase() |
78 | 78 |
|
79 | 79 | if ($.inArray(attrName, allowedAttributeList) !== -1) {
|
80 | 80 | if ($.inArray(attrName, uriAttrs) !== -1) {
|
|
115 | 115 | var createdDocument = document.implementation.createHTMLDocument('sanitization')
|
116 | 116 | createdDocument.body.innerHTML = unsafeHtml
|
117 | 117 |
|
118 |
| - var whitelistKeys = Object.keys(whiteList) |
| 118 | + var whitelistKeys = $.map(whiteList, function (el, i) { return i }) |
119 | 119 | var elements = $(createdDocument.body).find('*')
|
120 | 120 |
|
121 | 121 | for (var i = 0, len = elements.length; i < len; i++) {
|
|
131 | 131 | var attributeList = $.map(el.attributes, function (el) { return el })
|
132 | 132 | var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || [])
|
133 | 133 |
|
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) |
137 | 137 | }
|
138 |
| - }) |
| 138 | + } |
139 | 139 | }
|
140 | 140 |
|
141 | 141 | return createdDocument.body.innerHTML
|
|
217 | 217 | }
|
218 | 218 |
|
219 | 219 | Tooltip.prototype.getOptions = function (options) {
|
220 |
| - const dataAttributes = this.$element.data() |
| 220 | + var dataAttributes = this.$element.data() |
221 | 221 |
|
222 | 222 | for (var dataAttr in dataAttributes) {
|
223 | 223 | if (dataAttributes.hasOwnProperty(dataAttr) && $.inArray(dataAttr, DISALLOWED_ATTRIBUTES) !== -1) {
|
|
235 | 235 | }
|
236 | 236 |
|
237 | 237 | if (options.sanitize) {
|
238 |
| - config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn) |
| 238 | + options.template = sanitizeHtml(options.template, options.whiteList, options.sanitizeFn) |
239 | 239 | }
|
240 | 240 |
|
241 | 241 | return options
|
|
0 commit comments