1/** 2 * @file 3 * Maintains and deprecates Dialog jQuery events. 4 */ 5 6(function ($, Drupal, once) { 7 if (once('drupal-dialog-deprecation-listener', 'html').length) { 8 const eventSpecial = { 9 handle($event) { 10 const $element = $($event.target); 11 const event = $event.originalEvent; 12 const dialog = event.dialog; 13 const dialogArguments = [$event, dialog, $element, event?.settings]; 14 $event.handleObj.handler.apply(this, dialogArguments); 15 }, 16 }; 17 18 $.event.special['dialog:beforecreate'] = eventSpecial; 19 $.event.special['dialog:aftercreate'] = eventSpecial; 20 $.event.special['dialog:beforeclose'] = eventSpecial; 21 $.event.special['dialog:afterclose'] = eventSpecial; 22 23 const listenDialogEvent = (event) => { 24 const windowEvents = $._data(window, 'events'); 25 const isWindowHasDialogListener = windowEvents[event.type]; 26 if (isWindowHasDialogListener) { 27 Drupal.deprecationError({ 28 message: `jQuery event ${event.type} is deprecated in 10.3.0 and is removed from Drupal:12.0.0. See https://www.drupal.org/node/3422670`, 29 }); 30 } 31 }; 32 33 [ 34 'dialog:beforecreate', 35 'dialog:aftercreate', 36 'dialog:beforeclose', 37 'dialog:afterclose', 38 ].forEach((e) => window.addEventListener(e, listenDialogEvent)); 39 } 40})(jQuery, 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.