aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Minar2012-11-24 01:51:19 +0100
committerIgor Minar2012-11-26 15:45:04 +0100
commitb9a9f91fbf99b71cfde434b6277f4c7d2533556f (patch)
tree9edce6ac7329905c8dac9d5db1280721a1b889a3
parent650fd933df614ac733cd43fe31d81d622a2ce2bc (diff)
downloadangular.js-b9a9f91fbf99b71cfde434b6277f4c7d2533556f.tar.bz2
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
-rw-r--r--src/jqLite.js7
-rw-r--r--test/ngScenario/ApplicationSpec.js5
2 files changed, 2 insertions, 10 deletions
diff --git a/src/jqLite.js b/src/jqLite.js
index 90a363f3..26be5977 100644
--- a/src/jqLite.js
+++ b/src/jqLite.js
@@ -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;
}
diff --git a/test/ngScenario/ApplicationSpec.js b/test/ngScenario/ApplicationSpec.js
index 7384ecaa..0236b8d7 100644
--- a/test/ngScenario/ApplicationSpec.js
+++ b/test/ngScenario/ApplicationSpec.js
@@ -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() {