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

Commit ce80576

Browse files
vojtajinaIgorMinar
authored andcommitted
fix:jqLite: Set event.target on IE<8
IE<8's Event has not target property - it has srcElement property. Fix that to be consistent as jQuery.
1 parent 10da625 commit ce80576

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/jqLite.js

+3
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,9 @@ forEach({
369369
event.cancelBubble = true; //ie
370370
};
371371
}
372+
if (!event.target) {
373+
event.target = event.srcElement || document;
374+
}
372375
forEach(eventHandler.fns, function(fn){
373376
fn.call(element, event);
374377
});

test/jqLiteSpec.js

+9
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,15 @@ describe('jqLite', function(){
352352
expect(callback).toHaveBeenCalled();
353353
expect(callback.callCount).toBe(1);
354354
});
355+
356+
it('should set event.target on IE', function() {
357+
var elm = jqLite(a);
358+
elm.bind('click', function(event) {
359+
expect(event.target).toBe(a);
360+
});
361+
362+
browserTrigger(a, 'click');
363+
});
355364
});
356365

357366

0 commit comments

Comments
 (0)