aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorunknown2010-07-27 16:53:23 -0700
committerunknown2010-07-27 16:53:23 -0700
commit6bd8006edcbfe1dc1be8cb865fbcfe25157fe117 (patch)
tree72c421ab1e25ff62c24d8e8b8ca39fe823e57ec4
parent2a30a02f015dd54846bb62d1f05e82b3cf76ef9f (diff)
downloadangular.js-6bd8006edcbfe1dc1be8cb865fbcfe25157fe117.tar.bz2
fix IE native mothods are not functions, and preventDefault
-rw-r--r--src/Angular.js19
-rw-r--r--src/Parser.js13
-rw-r--r--src/jqLite.js4
3 files changed, 20 insertions, 16 deletions
diff --git a/src/Angular.js b/src/Angular.js
index 850fe34c..32e3ccf7 100644
--- a/src/Angular.js
+++ b/src/Angular.js
@@ -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) {
diff --git a/src/Parser.js b/src/Parser.js
index 5c2307e4..5eb75713 100644
--- a/src/Parser.js
+++ b/src/Parser.js
@@ -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]);
};
},
diff --git a/src/jqLite.js b/src/jqLite.js
index 26ca6dea..04682754 100644
--- a/src/jqLite.js
+++ b/src/jqLite.js
@@ -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);