1/** 2 * @file 3 * Resubmits exposed forms when the search is cleared. 4 */ 5 6(function (Drupal, once) { 7 Drupal.behaviors.exploreViewsExposedFormSearchCleared = { 8 attach() { 9 once('explore-search-cleared-submit', 'html', document).forEach(() => { 10 document.addEventListener('searchCleared', (event) => { 11 const target = event.detail?.target; 12 if (!(target instanceof Element)) { 13 return; 14 } 15 16 const form = target.closest('form'); 17 if (!form) { 18 return; 19 } 20 21 if (!form.dataset.drupalSelector?.startsWith('views-exposed-form')) { 22 return; 23 } 24 25 const submit = form.querySelector( 26 '.js-form-submit, button[type="submit"], input[type="submit"]', 27 ); 28 29 if (submit instanceof HTMLElement && !submit.hasAttribute('disabled')) { 30 submit.click(); 31 return; 32 } 33 }); 34 }); 35 }, 36 }; 37})(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.