-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(jqLite.cleanData): TypeError: Cannot read property 'events' of undefined #16641
Comments
This is a jQuery 1.x issue. Not sure which version it was fixed in, but jQuery 3.x (as well as AngularJS' built-in |
This is so wrong. It for years worked correctly elem._data('events') and recently was changed to incorrect elem._data().events with no obvious for me reason |
@alextkachman AngularJS hasn't supported jQuery 1.x since version 1.3 if I remember correctly. This version was released almost 4 years ago. Your configuration has been unsupported for a long time so something may randomly break even in a patch release; we can't prevent that from happening as we don't run unit tests with jQuery 1.x. You should move to a supported version of jQuery, i.e. 2.1 or newer. @gkalpak We can't just revert the change as jqLite doesn't support the two-param Fixing this issue requires to do one of the following:
I think what happens is jQuery 1.x uses |
Thx for the info, @mgol. Although jQuery 1.x is indeed not supported, I think option (3) is harmless (and straight forward). I'll submit a PR. |
This shouldn't happen in supported jQuery versions (2+), but if someone uses the unsupported 1.x version the app will break. The change that causes this new behavior was introduced in b7d396b. Even though jQuery 1.x is not supported, it is worth avoiding the unnecessary breakage (given how simple). Fixes angular#16641
…rns undefined This shouldn't happen in supported jQuery versions (2+), but if someone uses the unsupported 1.x version the app will break. The change that causes this new behavior was introduced in b7d396b. Even though jQuery 1.x is not supported, it is worth avoiding the unnecessary breakage (given how simple). Fixes angular#16641
…rns undefined This shouldn't happen in supported jQuery versions (2+), but if someone uses the unsupported 1.x version the app will break. The change that causes this new behavior was introduced in b7d396b. Even though jQuery 1.x is not supported, it is worth avoiding the unnecessary breakage (given how simple). Fixes #16641 Closes #16642
Yes, I forgot to add option 3 sounded the best to me as well as it's such a critical place and such an easy fix. |
I'm submitting a ...
Current behavior:
TypeError happens when data is cleaned for OBJECT element. OBJECT does not support data
Expected / new behavior:
no TypeError expected
Minimal reproduction of the problem with instructions:
OBJECT element removed by because of ng-if instruction
AngularJS version:
Angular 1.7.2
JQuery 1.10.2
Browser:
Presumably All
Anything else:
TypeError: Cannot read property 'events' of undefined
at Function.jqLite.cleanData (angular.js:2051)
at replaceWith (angular.js:10704)
at applyDirectivesToNode (angular.js:9768)
at compileNodes (angular.js:9293)
at compileNodes (angular.js:9305)
at compileNodes (angular.js:9305)
at compileNodes (angular.js:9305)
at compile (angular.js:9174)
at Object.link (angular.js:28966)
at angular.js:1364
The text was updated successfully, but these errors were encountered: