MCPcopy Create free account
hub / github.com/OpenIntroStat/ims / allowedAttribute

Function allowedAttribute

_freeze/site_libs/bsTable-3.3.7/bootstrapTable.js:76–99  ·  view source on GitHub ↗
(attr, allowedAttributeList)

Source from the content-addressed store, hash-verified

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) {

Callers 1

sanitizeHtmlFunction · 0.85

Calls 1

$Function · 0.50

Tested by

no test coverage detected