Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Uncaught TypeError: a.indexOf is not a function
at r.fn.init.r.fn.load (jquery.min.js?v=3.2.1:4)
at Object.attach (scripts.js?v=8.4.0:1)
at Object.Drupal.attachBehaviors (drupal.js?v=8.4.0:25)
at drupal.init.js?v=8.4.0:16
at HTMLDocument.t (ready.min.js?v=1.0.8:4)
Comments
Comment #2
denisomerovic CreditAttribution: denisomerovic commentedComment #3
catchCould you confirm which contrib modules are in use, especially advagg (and if so whether it's up to date?).
Comment #4
denisomerovic CreditAttribution: denisomerovic commentedI don't think it's a module issue. Drupal 8.4 comes with jquery 3 and jquery 3 doesn't allow load() function. I think i get this error as soon as i installed drupal 8.4
Comment #5
catchSo this is a new clean install of 8.4? Not an update from 8.3?
Comment #6
xjm@denisomerovic, we need to know what modules or custom code you have that's causing this error, i.e. what is calling the
load()
method. Probably something is incompatible with jQuery 3, but to our knowledge core itself has had all its JS updated to be compatible. So we need steps to reproduce, or what modules are installed.Comment #7
xjmComment #8
denisomerovic CreditAttribution: denisomerovic commentedYeah, clean install not an upgrade. In my modules folder i have admin_toolbar, colorbox, contact_block, ctools, devel, module_filter, pathauto, svg_image, token.
Comment #9
cilefen CreditAttribution: cilefen at Institute for Advanced Study commented@denisomerovic Which of those modules is installed?
Comment #10
denisomerovic CreditAttribution: denisomerovic commented@cilefen all of them.
Comment #11
denisomerovic CreditAttribution: denisomerovic commentedI tested again fresh installation of Drupal 8.4.0. Also i installed base theme https://www.drupal.org/project/basic and once i uncomment scripts.js it shows the error. So this is probably something with basic theme?
Comment #12
kevinquillen CreditAttribution: kevinquillen at Velir commentedSee: https://jquery.com/upgrade-guide/3.0/#breaking-change-load-unload-and-er...
The scripts.js file contains a call to .load().
Comment #13
kevinquillen CreditAttribution: kevinquillen at Velir commentedComment #14
kevinquillen CreditAttribution: kevinquillen at Velir commenteddenisomerovic "Basic" is not a base theme from Drupal, it is a contributed theme and has been moved to its project issue queue.
Comment #15
denisomerovic CreditAttribution: denisomerovic commented@kevinquillen that's right, the theme calls a .load(). so instead it should go
$(window).on('load', function () {
});
Now the errors are gone. Thanks
Comment #16
kevinquillen CreditAttribution: kevinquillen at Velir commentedWell, its not "fixed" because this can happen to anyone who downloads Basic and is using 8.4.x+. It should be resolved here.
Comment #17
xjmClarifying title. Thanks for confirming it's being caused by the Basic theme.
Comment #18
denisomerovic CreditAttribution: denisomerovic commentedThank you all.
Comment #19
joelpittetThanks, I've committed changes to remove those functions in favour of
on('event'
Comment #22
leahtard CreditAttribution: leahtard at The Jibe commentedThanks for the fix Joel! I have 8.x-1.3 queued up for release.
Cheers, Leah
Comment #24
vitaliych CreditAttribution: vitaliych commentedI have installed fresh drupal 8.4.2 got few modules and themes everything seams to work fine
but when i'm trying to use editor in any case editing custom block or content for example trying to insert picture i'm getting similar error message
drupal.js:13 Uncaught TypeError: $context.find(...).once is not a function
at initFileValidation (:15:33)
at Array.forEach ()
at Object.attach (:20:31)
at Object.Drupal.attachBehaviors (drupal.js:25)
at Drupal.AjaxCommands.insert (ajax.js:516)
at Drupal.Ajax.success (ajax.js:407)
at Object.success (ajax.js:222)
at i (jquery.min.js:2)
at Object.fireWith [as resolveWith] (jquery.min.js:2)
at A (jquery.min.js:4)
What should i do about it , how to fix the issue?
Comment #25
denisomerovic CreditAttribution: denisomerovic commentedI don't think that is related to this issue but try add under dependencies - core/jquery.once in your theme.libraries.yml file.
Something like this below.
Comment #26
krishnaveni.t CreditAttribution: krishnaveni.t commented@denisomerovic
Thanks.
#25 Worked well.
Comment #27
tapas_talukder CreditAttribution: tapas_talukder commentedI have change the jQuery(window).load() to jQuery(document).ready() function and its working fine.
Actually on jquery 3 and 3+ version does not support load function.