Hi. My Leaflet widget (to enter geo info when adding or editing a specific content type) stopped working. Inspecting the browoser debugger I get this but I'm not sure what the problem is.

 



jQuery.Deferred exception: $(...).has(...).size is not a function attach/<@https://mydomain.com/files/js/js_LyLvdRRHNxtwYfByCc-GqR7P65JfX97F_Q5mGroaB0E.js:125:62
each@https://mydomain.com/files/js/js_qcuQasNlfIq7236oVf0NRWYeUUrasWXW4qABbJzWJEo.js:2:3129
each@https://mydomain.com/files/js/js_qcuQasNlfIq7236oVf0NRWYeUUrasWXW4qABbJzWJEo.js:2:1594
$.fn.once@https://mydomain.com/files/js/js_qcuQasNlfIq7236oVf0NRWYeUUrasWXW4qABbJzWJEo.js:74:47
attach@https://mydomain.com/files/js/js_LyLvdRRHNxtwYfByCc-GqR7P65JfX97F_Q5mGroaB0E.js:112:40
Backdrop.attachBehaviors/<@https://mydomain.com/files/js/js_qcuQasNlfIq7236oVf0NRWYeUUrasWXW4qABbJzWJEo.js:174:12
each@https://mydomain.com/files/js/js_qcuQasNlfIq7236oVf0NRWYeUUrasWXW4qABbJzWJEo.js:2:3179
Backdrop.attachBehaviors@https://mydomain.com/files/js/js_qcuQasNlfIq7236oVf0NRWYeUUrasWXW4qABbJzWJEo.js:172:5
@https://mydomain.com/files/js/js_qcuQasNlfIq7236oVf0NRWYeUUrasWXW4qABbJzWJEo.js:800:12
e@https://mydomain.com/files/js/js_qcuQasNlfIq7236oVf0NRWYeUUrasWXW4qABbJzWJEo.js:2:27028
Deferred/then/l/</t<@https://mydomain.com/files/js/js_qcuQasNlfIq7236oVf0NRWYeUUrasWXW4qABbJzWJEo.js:2:27330
 undefined js_qcuQasNlfIq7236oVf0NRWYeUUrasWXW4qABbJzWJEo.js:2:28648
Uncaught TypeError: $(...).has(...).size is not a function
    attach https://mydomain.com/files/js/js_LyLvdRRHNxtwYfByCc-GqR7P65JfX97F_Q5mGroaB0E.js:125
    each https://mydomain.com/files/js/js_qcuQasNlfIq7236oVf0NRWYeUUrasWXW4qABbJzWJEo.js:2
    each https://mydomain.com/files/js/js_qcuQasNlfIq7236oVf0NRWYeUUrasWXW4qABbJzWJEo.js:2
    once https://mydomain.com/files/js/js_qcuQasNlfIq7236oVf0NRWYeUUrasWXW4qABbJzWJEo.js:74
    attach https://mydomain.com/files/js/js_LyLvdRRHNxtwYfByCc-GqR7P65JfX97F_Q5mGroaB0E.js:112
    attachBehaviors https://mydomain.com/files/js/js_qcuQasNlfIq7236oVf0NRWYeUUrasWXW4qABbJzWJEo.js:174
    each https://mydomain.com/files/js/js_qcuQasNlfIq7236oVf0NRWYeUUrasWXW4qABbJzWJEo.js:2
    attachBehaviors https://mydomain.com/files/js/js_qcuQasNlfIq7236oVf0NRWYeUUrasWXW4qABbJzWJEo.js:172
    <anonymous> https://mydomain.com/files/js/js_qcuQasNlfIq7236oVf0NRWYeUUrasWXW4qABbJzWJEo.js:800
    e https://mydomain.com/files/js/js_qcuQasNlfIq7236oVf0NRWYeUUrasWXW4qABbJzWJEo.js:2
    t https://mydomain.com/files/js/js_qcuQasNlfIq7236oVf0NRWYeUUrasWXW4qABbJzWJEo.js:2
js_LyLvdRRHNxtwYfByCc-GqR7P65JfX97F_Q5mGroaB0E.js:125:62
Source map error: request failed with status 404
Resource URL: https://mydomain.com/files/js/js_z68GC3Tk5qrwx4Hil888vepBQC5JVVRoFxpplnRlJhM.js
Source Map URL: leaflet.js.map;

​

Comments

The jQuery size method has been removed in jQuery 3. See https://api.jquery.com/size/

One of your Javascript files is still using that method, and therefore it's giving a fatal error. It's probably not Leaflet, since I checked the repository and that doesn't seem to use it.

Since your site is aggregating Javascript, it's not possible to see where the error is occurring from what you pasted. Please go to Configuration > Development > Performance and uncheck "Aggregate Javascript files", then visit the page again to trigger the error, and check where (in which file) it's occurring. Then report here.

 

indigoxela's picture

No, for sure not Leaflet, those modules are fully compatible with jQuery 3.

There has been some activity re removed jQuery size() method in contrib land.

What you could do now:

  1. Temporarily switch to the legacy version on admin/config/development/jquery
  2. Or identify the offending contrib module and check their issue queue (report or test an already available patch)

To identify you could disable Javascript aggregation on admin/config/development/performance (temporarily). Stick with jQuery 3 and then you should be able to figure out, where the nagging points to.