Skip to content
Snippets Groups Projects

Issue #3350919: Uncaught TypeError: $(...).once is not a function with Drupal 10

2 files
+ 11
7
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 8
5
(function ($, Drupal) {
(function ($, Drupal, once) {
'use strict'
'use strict'
@@ -110,10 +110,13 @@
@@ -110,10 +110,13 @@
modal_minimized_class = block_id + '-modal-minimized'
modal_minimized_class = block_id + '-modal-minimized'
layout_class = '.' + modal_class + ' .spb-popup-main-wrapper'
layout_class = '.' + modal_class + ' .spb-popup-main-wrapper'
// Wrap arround elements
// Wrap arround elements
$(css_identity + block_id).once().
once('wrap-arround', css_identity + block_id).forEach(function(elem) {
wrap($('<div class="' + modal_class + '"></div>'))
$(elem).wrap($('<div class="' + modal_class + '"></div>'))
 
});
// Hide the popup initially
// Hide the popup initially
$('.' + modal_class).once().hide()
once('hide-popup', '.' + modal_class).forEach(function(elem) {
 
$(elem).hide()
 
})
// Wrap remaining elements
// Wrap remaining elements
if ($(css_identity + block_id).closest('.spb-popup-main-wrapper').length) {
if ($(css_identity + block_id).closest('.spb-popup-main-wrapper').length) {
@@ -357,4 +360,4 @@
@@ -357,4 +360,4 @@
return null
return null
}
}
})(jQuery, Drupal)
})(jQuery, Drupal, once)
Loading