1/** 2 * @file 3 * Additional functionality for HTML5 details elements. 4 */ 5 6(function ($) { 7 /** 8 * Open parent details elements of a targeted page fragment. 9 * 10 * Opens all (nested) details element on a hash change or fragment link click 11 * when the target is a child element, in order to make sure the targeted 12 * element is visible. Aria attributes on the summary 13 * are set by triggering the click event listener in details-aria.js. 14 * 15 * @param {jQuery.Event} e 16 * The event triggered. 17 * @param {jQuery} $target 18 * The targeted node as a jQuery object. 19 */ 20 const handleFragmentLinkClickOrHashChange = (e, $target) => { 21 $target.parents('details').not('[open]').find('> summary').trigger('click'); 22 }; 23 24 /** 25 * Binds a listener to handle fragment link clicks and URL hash changes. 26 */ 27 $('body').on( 28 'formFragmentLinkClickOrHashChange.details', 29 handleFragmentLinkClickOrHashChange, 30 ); 31 32 /** 33 * Binds a listener to handle required fields in details elements. 34 */ 35 window.addEventListener( 36 'invalid', 37 (event) => { 38 if (event.target.matches('details input[required]')) { 39 handleFragmentLinkClickOrHashChange(event, $(event.target)); 40 } 41 }, 42 { capture: true }, 43 ); 44})(jQuery);
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.