Skip to content

Commit 0af763d

Browse files
IgorMinarmhevery
authored andcommitted
properly handle event's stopPropagation() and preventDefault() method in IE
1 parent eb8d46d commit 0af763d

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/jqLite.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,14 @@ JQLite.prototype = {
9999
bind[type] = eventHandler = function(event) {
100100
if (!event.preventDefault) {
101101
event.preventDefault = function(){
102-
event.returnValue = false;
102+
event.returnValue = false; //ie
103103
};
104104
}
105+
if (!event.stopPropagation) {
106+
event.stopPropagation = function() {
107+
event.cancelBubble = true; //ie
108+
}
109+
}
105110
foreach(eventHandler.fns, function(fn){
106111
fn.call(self, event);
107112
});
@@ -194,9 +199,8 @@ JQLite.prototype = {
194199
} else if (isDefined(value)) {
195200
e.setAttribute(name, value);
196201
} else {
197-
var attributes = e.attributes,
198-
item = attributes ? attributes.getNamedItem(name) : _undefined;
199-
return item && item.specified ? item.value : _undefined;
202+
// the extra argument is to get the right thing for a.href in IE, see jQuery code
203+
return e.getAttribute(name, 2);
200204
}
201205
},
202206

0 commit comments

Comments
 (0)