1ACC.sanitizer = { 2 3 matcher: /<\/?([a-zA-Z0-9]+)*(.*?)\/?>/igm, 4 5 whitelist: [ 6 'pre', 7 'address', 8 'em', 9 'hr' 10 ], 11 12 sanitize: function(html, useWhitelist) { 13 useWhitelist=true; 14 html = (String(html) || ''); 15 16 var matches = ACC.sanitizer.match(html); 17 18 matches.forEach(function(tag){ 19 if (!useWhitelist || ACC.sanitizer.whitelist.indexOf(tag.name) == -1) { 20 html = html.replace(tag.full, ''); 21 } 22 }); 23 24 return html; 25 }, 26 27 match: function(html) { 28 html = String(html) || ''; 29 30 var matches = [], 31 match; 32 33 while ((match = ACC.sanitizer.matcher.exec(html)) != null) { 34 var attrr = match[2].split(' '), 35 attrs = []; 36 37 // extract attributes from the tag 38 attrr.shift(); 39 attrr.forEach(function(attr){ 40 attr = attr.split('='); 41 var attr_name = attr[0], 42 attr_val = attr.length > 1 ? attr.slice(1).join('=') : null; 43 // remove quotes from attributes 44 if (attr_val && attr_val.charAt(0).match(/'|"/)) attr_val = attr_val.slice(1); 45 if (attr_val && attr_val.charAt(attr_val.length-1).match(/'|"/)) attr_val = attr_val.slice(0, -1); 46 attr = { 47 name: attr_name, 48 value: attr_val 49 }; 50 if (!attr.value) delete attr.value; 51 if (attr.name) attrs.push(attr); 52 }); 53 54 var tag = { 55 full: match[0], 56 name: match[1], 57 attr: attrs 58 }; 59 60 matches.push(tag); 61 } 62 63 return matches; 64 } 65};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.