From e2154cbc0b9265bea04ce328879d4e9bf1c67c51 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Mon, 7 Feb 2011 15:15:14 -0800 Subject: remove dom manipulation API from compiler --- src/Angular.js | 5 ++++- src/Compiler.js | 3 --- src/markups.js | 4 ++-- src/widgets.js | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/Angular.js b/src/Angular.js index 9a1ab4a2..f9047d32 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -273,7 +273,10 @@ function jqLiteWrap(element) { if (element) { if (isString(element)) { var div = document.createElement('div'); - div.innerHTML = element; + // Read about the NoScope elements here: + // http://msdn.microsoft.com/en-us/library/ms533897(VS.85).aspx + div.innerHTML = '
 
' + element; // IE insanity to make NoScope elements work! + div.removeChild(div.firstChild); // remove the superfluous div element = new JQLite(div.childNodes); } else if (!(element instanceof JQLite)) { element = new JQLite(element); diff --git a/src/Compiler.js b/src/Compiler.js index d1505404..804a9622 100644 --- a/src/Compiler.js +++ b/src/Compiler.js @@ -178,9 +178,6 @@ Compiler.prototype = { template, selfApi = { compile: bind(self, self.compile), - comment:function(text) {return jqLite(document.createComment(text));}, - element:function(type) {return jqLite(document.createElement(type));}, - text:function(text) {return jqLite(document.createTextNode(text));}, descend: function(value){ if(isDefined(value)) descend = value; return descend;}, directives: function(value){ if(isDefined(value)) directives = value; return directives;}, scope: function(value){ if(isDefined(value)) template.newScope = template.newScope || value; return template.newScope;} diff --git a/src/markups.js b/src/markups.js index 89cc0d05..99e1cca7 100644 --- a/src/markups.js +++ b/src/markups.js @@ -38,10 +38,10 @@ angularTextMarkup('{{}}', function(text, textNode, parentElement) { forEach(parseBindings(text), function(text){ var exp = binding(text); if (exp) { - newElement = self.element('span'); + newElement = jqLite(''); newElement.attr('ng:bind', exp); } else { - newElement = self.text(text); + newElement = jqLite(document.createTextNode(text)); } if (msie && text.charAt(0) == ' ') { newElement = jqLite(' '); diff --git a/src/widgets.js b/src/widgets.js index f8efae60..7438254d 100644 --- a/src/widgets.js +++ b/src/widgets.js @@ -890,7 +890,7 @@ angularWidget('a', function() { */ angularWidget("@ng:repeat", function(expression, element){ element.removeAttr('ng:repeat'); - element.replaceWith(this.comment("ng:repeat: " + expression)); + element.replaceWith(jqLite("")); var template = this.compile(element); return function(reference){ var match = expression.match(/^\s*(.+)\s+in\s+(.*)\s*$/), -- cgit v1.2.3