jqLite#removeData shouldn't touch the event handlers' storage #15869
Description
I'm submitting a ...
- bug report
- feature request
- other (Please do not submit support requests here (see above))
Current behavior:
jqLite#removeData
currently:
- Clears the element data.
- Detaches event handlers.
Expected / new behavior:
The second behavior is incorrect; the only data touched should be user-provided data, i.e. those set via elem.data(key, value)
. That's how jQuery behaves.
If complete deallocation of event handlers is required as well, one can use:
jqLite.cleanData(elements);
Note that currently jqLite.cleanData
defers to jqLiteRemoveData
under the hood so its implementation will have to be changed when jqLiteRemoveData
is fixed.
Minimal reproduction of the problem with instructions:
AngularJS + jqLite (handler removed): http://plnkr.co/edit/XBw30umyz68UnERE9LyS?p=preview
AngularJS + jQuery (handler not removed): http://plnkr.co/edit/sdo9ShVA66yuEIIEvlII?p=preview
Angular version: 1.x.y
1.6.3, snapshot as well
Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
All
Anything else:
This will require a breaking change in jqLite. Setting to 1.7.0.