Every line of 'html data attribute jquery' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
154 function getAttributeData(attribute) { 155 var data = "<div class='attr'"; 156 157 var type = attribute.attr("type"); 158 if (typeof type != 'undefined') 159 data += " attrType='" + type + "'"; 160 161 var score = attribute.attr("score"); 162 if (typeof score != 'undefined') 163 data += " attrScore='" + score + "'"; 164 165 data += "><div class='attrTypeLabel'>" + attribute.attr("typeLabel") 166 + "</div>"; 167 168 var label = attribute.attr("label"); 169 if (typeof label != 'undefined') 170 data += "<div class='attrLabel'>" + label + "</div>"; 171 172 if (attribute.attr("type") == "ratio") { 173 data += "<div class='attrUnit'>" + attribute.attr("unit") + "</div>"; 174 175 var value = convertValueToNiceString(attribute.attr("value")); 176 if (value != null) 177 data += "<div class='attrVal'>" + value + "</div>"; 178 179 var minValue = convertValueToNiceString(attribute.attr("minValue")); 180 if (minValue != null) 181 data += "<div class='attrMinVal'>" + minValue + "</div>"; 182 183 var maxValue = convertValueToNiceString(attribute.attr("maxValue")); 184 if (maxValue != null) 185 data += "<div class='attrMaxVal'>" + maxValue + "</div>"; 186 } 187 188 $(attribute).children("valueReference").each(function() { 189 data += "<div class='attrValueRef'>"; 190 data += getAttributeData($(this)); 191 data += "</div>"; 192 }); 193 194 data += "</div>"; 195 return data; 196 }
Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code
53 function getDataFromAttr (selector, attr, $) { 54 const data = $(selector) ? $(selector)[0] : null 55 let valueToReturn = null 56 57 if (data) { 58 const { attribs: { [attr]: value } } = data 59 60 console.log({value}) 61 valueToReturn = value 62 } 63 64 return valueToReturn 65 }
239 function extractValue ($, attribute) { 240 if ($ && $.length) { 241 return $.attr(attribute) || undefined 242 } 243 return undefined 244 }
144 function data (node, attr) { 145 return node.getAttribute('data-' + attr) 146 }