diff options
Diffstat (limited to 'src/Compiler.js')
| -rw-r--r-- | src/Compiler.js | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/Compiler.js b/src/Compiler.js index 9faafb13..e09f1876 100644 --- a/src/Compiler.js +++ b/src/Compiler.js @@ -30,7 +30,9 @@ Template.prototype = { element = jqLite(element); foreach(this.inits, function(fn) { queue.push(function(scope) { - scope.$tryEval(fn, element, element); + scope.$tryEval(function(){ + return fn.call(scope, element); + }, element); }); }); @@ -67,8 +69,8 @@ Template.prototype = { /////////////////////////////////// //Compiler ////////////////////////////////// -function Compiler(textMarkup, attrMarkup, directives, widgets){ - this.textMarkup = textMarkup; +function Compiler(markup, attrMarkup, directives, widgets){ + this.markup = markup; this.attrMarkup = attrMarkup; this.directives = directives; this.widgets = widgets; @@ -121,20 +123,25 @@ Compiler.prototype = { descend: function(value){ if(isDefined(value)) descend = value; return descend;}, directives: function(value){ if(isDefined(value)) directives = value; return directives;} }; - priority = element.attr('ng:eval-order') || priority || 0; + try { + priority = element.attr('ng:eval-order') || priority || 0; + } catch (e) { + // for some reason IE throws error under some weird circumstances. so just assume nothing + priority = priority || 0; + } if (isString(priority)) { priority = PRIORITY[uppercase(priority)] || 0; } template = new Template(priority); eachAttribute(element, function(value, name){ if (!widget) { - if (widget = self.widgets['@' + name]) { + if (widget = self.widgets('@' + name)) { widget = bind(selfApi, widget, value, element); } } }); if (!widget) { - if (widget = self.widgets[nodeName(element)]) { + if (widget = self.widgets(nodeName(element))) { widget = bind(selfApi, widget, element); } } @@ -151,7 +158,7 @@ Compiler.prototype = { // process markup for text nodes only eachTextNode(element, function(textNode){ var text = textNode.text(); - foreach(self.textMarkup, function(markup){ + foreach(self.markup, function(markup){ markup.call(selfApi, text, textNode, element); }); }); |
