1(function (Drupal, once) { 2 3 function isValidHttpUrl(string, base) { 4 let url; 5 try { 6 url = new URL(string, base); 7 } catch (_) { 8 return false; 9 } 10 return url.protocol === 'http:' || url.protocol === 'https:'; 11 } 12 13 Drupal.behaviors.klaroSanitize = { 14 attach(context) { 15 once('klaro-sanitize', 'a[data-href]', context).forEach((anchor) => { 16 const dataHref = anchor.getAttribute('data-href'); 17 if (!isValidHttpUrl(dataHref, context.location.origin)) { 18 anchor.setAttribute('data-href', '#'); 19 } 20 }); 21 } 22 }; 23 24}(Drupal, once));
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.