mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 07:40:22 +00:00
fix IE native mothods are not functions, and preventDefault
This commit is contained in:
parent
2a30a02f01
commit
6bd8006edc
3 changed files with 20 additions and 16 deletions
|
|
@ -293,13 +293,18 @@ function escapeAttr(html) {
|
|||
|
||||
function bind(_this, _function) {
|
||||
var curryArgs = slice.call(arguments, 2, arguments.length);
|
||||
return curryArgs.length == 0 ?
|
||||
function() {
|
||||
return _function.apply(_this, arguments);
|
||||
} :
|
||||
function() {
|
||||
return _function.apply(_this, curryArgs.concat(slice.call(arguments, 0, arguments.length)));
|
||||
};
|
||||
if (typeof _function == 'function') {
|
||||
return curryArgs.length == 0 ?
|
||||
function() {
|
||||
return _function.apply(_this, arguments);
|
||||
} :
|
||||
function() {
|
||||
return _function.apply(_this, curryArgs.concat(slice.call(arguments, 0, arguments.length)));
|
||||
}
|
||||
} else {
|
||||
// in IE, native methonds ore not functions and so they can not be bound (but they don't need to be)
|
||||
return function(a, b, c, d, e){ return _function(a, b, c, d, e); };
|
||||
}
|
||||
}
|
||||
|
||||
function outerHTML(node) {
|
||||
|
|
|
|||
|
|
@ -599,14 +599,11 @@ Parser.prototype = {
|
|||
for ( var i = 0; i < argsFn.length; i++) {
|
||||
args.push(argsFn[i](self));
|
||||
}
|
||||
var fnPtr = fn(self);
|
||||
if (typeof fnPtr === 'function') {
|
||||
return fnPtr.apply(self, args);
|
||||
} else if (fnPtr === undefined) {
|
||||
return fnPtr;
|
||||
} else {
|
||||
throw "Expression '" + fn.isAssignable + "' is not a function.";
|
||||
}
|
||||
var fnPtr = fn(self) || noop;
|
||||
// IE stupidity!
|
||||
return fnPtr.apply ?
|
||||
fnPtr.apply(self, args) :
|
||||
fnPtr(args[0], args[1], args[2], args[3], args[4]);
|
||||
};
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,9 @@ JQLite.prototype = {
|
|||
if (!eventHandler) {
|
||||
bind[type] = eventHandler = function(event) {
|
||||
if (!event.preventDefault) {
|
||||
event.returnValue = false;
|
||||
event.preventDefault = function(){
|
||||
event.returnValue = false;
|
||||
}
|
||||
}
|
||||
foreach(eventHandler.fns, function(fn){
|
||||
fn.call(self, event);
|
||||
|
|
|
|||
Loading…
Reference in a new issue