aboutsummaryrefslogtreecommitdiffstats
path: root/src/Angular.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/Angular.js')
-rw-r--r--src/Angular.js35
1 files changed, 12 insertions, 23 deletions
diff --git a/src/Angular.js b/src/Angular.js
index 42e2ce89..3970f762 100644
--- a/src/Angular.js
+++ b/src/Angular.js
@@ -291,30 +291,20 @@ function escapeAttr(html) {
'"');
}
-function bind(_this, _function) {
- var curryArgs = slice.call(arguments, 2, 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)));
- };
+function bind(self, fn) {
+ var curryArgs = arguments.length > 2 ? slice.call(arguments, 2, arguments.length) : [];
+ if (typeof fn == 'function') {
+ return curryArgs.length ? function() {
+ return arguments.length ? fn.apply(self, curryArgs.concat(slice.call(arguments, 0, arguments.length))) : fn.apply(self, curryArgs);
+ }: function() {
+ return arguments.length ? fn.apply(self, arguments) : fn.call(self);
+ };
} else {
// in IE, native methods ore not functions and so they can not be bound (but they don't need to be)
- return _function;
+ return fn;
}
}
-function outerHTML(node) {
- var temp = document.createElement('div');
- temp.appendChild(node);
- var outerHTML = temp.innerHTML;
- temp.removeChild(node);
- return outerHTML;
-}
-
function toBoolean(value) {
if (value && value.length !== 0) {
var v = lowercase("" + value);
@@ -338,12 +328,11 @@ function merge(src, dst) {
}
}
-function compile(element, parentScope) {
+function compile(element, existingScope) {
var compiler = new Compiler(angularTextMarkup, angularAttrMarkup, angularDirective, angularWidget),
- $element = jqLite(element),
- parent = extend({}, parentScope);
+ $element = jqLite(element);
parent.$element = $element;
- return compiler.compile($element)($element, parent);
+ return compiler.compile($element)($element, existingScope);
}
/////////////////////////////////////////////////