mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-04-05 23:51:03 +00:00
fix(jqLite): fire $destroy event via triggerHandler
in jQuery 1.8.x the data() data structure is changed and events are not accessible via data().events. Since all we need is to trigger all event handlers, we can do so via triggerHandler() api instead of mocking with the internal jQuery data structures. This fix was originally proposed by PeteAppleton via PR #1512. Closes #1512
This commit is contained in:
parent
7530654328
commit
269fb43b36
2 changed files with 2 additions and 10 deletions
|
|
@ -130,12 +130,7 @@ function JQLitePatchJQueryRemove(name, dispatchThis) {
|
|||
for(setIndex = 0, setLength = set.length; setIndex < setLength; setIndex++) {
|
||||
element = jqLite(set[setIndex]);
|
||||
if (fireEvent) {
|
||||
events = element.data('events');
|
||||
if ( (fns = events && events.$destroy) ) {
|
||||
forEach(fns, function(fn){
|
||||
fn.handler();
|
||||
});
|
||||
}
|
||||
element.triggerHandler('$destroy');
|
||||
} else {
|
||||
fireEvent = !fireEvent;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,10 +5,7 @@ describe('angular.scenario.Application', function() {
|
|||
var app, frames;
|
||||
|
||||
function callLoadHandlers(app) {
|
||||
var handlers = app.getFrame_().data('events').load;
|
||||
expect(handlers).toBeDefined();
|
||||
expect(handlers.length).toEqual(1);
|
||||
handlers[0].handler();
|
||||
var handler = app.getFrame_().triggerHandler('load')
|
||||
}
|
||||
|
||||
beforeEach(function() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue