mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-08 23:04:45 +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) {
|
function bind(_this, _function) {
|
||||||
var curryArgs = slice.call(arguments, 2, arguments.length);
|
var curryArgs = slice.call(arguments, 2, arguments.length);
|
||||||
return curryArgs.length == 0 ?
|
if (typeof _function == 'function') {
|
||||||
function() {
|
return curryArgs.length == 0 ?
|
||||||
return _function.apply(_this, arguments);
|
function() {
|
||||||
} :
|
return _function.apply(_this, arguments);
|
||||||
function() {
|
} :
|
||||||
return _function.apply(_this, curryArgs.concat(slice.call(arguments, 0, arguments.length)));
|
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) {
|
function outerHTML(node) {
|
||||||
|
|
|
||||||
|
|
@ -599,14 +599,11 @@ Parser.prototype = {
|
||||||
for ( var i = 0; i < argsFn.length; i++) {
|
for ( var i = 0; i < argsFn.length; i++) {
|
||||||
args.push(argsFn[i](self));
|
args.push(argsFn[i](self));
|
||||||
}
|
}
|
||||||
var fnPtr = fn(self);
|
var fnPtr = fn(self) || noop;
|
||||||
if (typeof fnPtr === 'function') {
|
// IE stupidity!
|
||||||
return fnPtr.apply(self, args);
|
return fnPtr.apply ?
|
||||||
} else if (fnPtr === undefined) {
|
fnPtr.apply(self, args) :
|
||||||
return fnPtr;
|
fnPtr(args[0], args[1], args[2], args[3], args[4]);
|
||||||
} else {
|
|
||||||
throw "Expression '" + fn.isAssignable + "' is not a function.";
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,9 @@ JQLite.prototype = {
|
||||||
if (!eventHandler) {
|
if (!eventHandler) {
|
||||||
bind[type] = eventHandler = function(event) {
|
bind[type] = eventHandler = function(event) {
|
||||||
if (!event.preventDefault) {
|
if (!event.preventDefault) {
|
||||||
event.returnValue = false;
|
event.preventDefault = function(){
|
||||||
|
event.returnValue = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
foreach(eventHandler.fns, function(fn){
|
foreach(eventHandler.fns, function(fn){
|
||||||
fn.call(self, event);
|
fn.call(self, event);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue