diff options
| author | Igor Minar | 2010-10-01 07:33:34 +0800 |
|---|---|---|
| committer | Misko Hevery | 2010-10-01 07:44:45 +0800 |
| commit | 0af763dcec8b9f6b17208ac58607cd1124382f63 (patch) | |
| tree | bc03a28f9890f609b69d5692b01eb01f6099c04a | |
| parent | eb8d46d380a2005dbec3973d40e1dbc27991fdb7 (diff) | |
| download | angular.js-0af763dcec8b9f6b17208ac58607cd1124382f63.tar.bz2 | |
properly handle event's stopPropagation() and preventDefault() method in IE
| -rw-r--r-- | src/jqLite.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/jqLite.js b/src/jqLite.js index 5f1b9730..64e73497 100644 --- a/src/jqLite.js +++ b/src/jqLite.js @@ -99,9 +99,14 @@ JQLite.prototype = { bind[type] = eventHandler = function(event) { if (!event.preventDefault) { event.preventDefault = function(){ - event.returnValue = false; + event.returnValue = false; //ie }; } + if (!event.stopPropagation) { + event.stopPropagation = function() { + event.cancelBubble = true; //ie + } + } foreach(eventHandler.fns, function(fn){ fn.call(self, event); }); @@ -194,9 +199,8 @@ JQLite.prototype = { } else if (isDefined(value)) { e.setAttribute(name, value); } else { - var attributes = e.attributes, - item = attributes ? attributes.getNamedItem(name) : _undefined; - return item && item.specified ? item.value : _undefined; + // the extra argument is to get the right thing for a.href in IE, see jQuery code + return e.getAttribute(name, 2); } }, |
