Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 269fb43

Browse files
committed
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
1 parent 7530654 commit 269fb43

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

src/jqLite.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,7 @@ function JQLitePatchJQueryRemove(name, dispatchThis) {
130130
for(setIndex = 0, setLength = set.length; setIndex < setLength; setIndex++) {
131131
element = jqLite(set[setIndex]);
132132
if (fireEvent) {
133-
events = element.data('events');
134-
if ( (fns = events && events.$destroy) ) {
135-
forEach(fns, function(fn){
136-
fn.handler();
137-
});
138-
}
133+
element.triggerHandler('$destroy');
139134
} else {
140135
fireEvent = !fireEvent;
141136
}

test/ngScenario/ApplicationSpec.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ describe('angular.scenario.Application', function() {
55
var app, frames;
66

77
function callLoadHandlers(app) {
8-
var handlers = app.getFrame_().data('events').load;
9-
expect(handlers).toBeDefined();
10-
expect(handlers.length).toEqual(1);
11-
handlers[0].handler();
8+
var handler = app.getFrame_().triggerHandler('load')
129
}
1310

1411
beforeEach(function() {

0 commit comments

Comments
 (0)