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

Commit

Permalink
fix:jqLite: Set event.target on IE<8
Browse files Browse the repository at this point in the history
IE<8's Event has not target property - it has srcElement property.
Fix that to be consistent as jQuery.
  • Loading branch information
vojtajina authored and IgorMinar committed Jul 13, 2011
1 parent 10da625 commit ce80576
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/jqLite.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,9 @@ forEach({
event.cancelBubble = true; //ie
};
}
if (!event.target) {
event.target = event.srcElement || document;
}
forEach(eventHandler.fns, function(fn){
fn.call(element, event);
});
Expand Down
9 changes: 9 additions & 0 deletions test/jqLiteSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,15 @@ describe('jqLite', function(){
expect(callback).toHaveBeenCalled();
expect(callback.callCount).toBe(1);
});

it('should set event.target on IE', function() {
var elm = jqLite(a);
elm.bind('click', function(event) {
expect(event.target).toBe(a);
});

browserTrigger(a, 'click');
});
});


Expand Down

0 comments on commit ce80576

Please sign in to comment.