Skip to content

Commit e2154cb

Browse files
committed
remove dom manipulation API from compiler
1 parent 0a5c00a commit e2154cb

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/Angular.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,10 @@ function jqLiteWrap(element) {
273273
if (element) {
274274
if (isString(element)) {
275275
var div = document.createElement('div');
276-
div.innerHTML = element;
276+
// Read about the NoScope elements here:
277+
// http://msdn.microsoft.com/en-us/library/ms533897(VS.85).aspx
278+
div.innerHTML = '<div>&nbsp;</div>' + element; // IE insanity to make NoScope elements work!
279+
div.removeChild(div.firstChild); // remove the superfluous div
277280
element = new JQLite(div.childNodes);
278281
} else if (!(element instanceof JQLite)) {
279282
element = new JQLite(element);

src/Compiler.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,6 @@ Compiler.prototype = {
178178
template,
179179
selfApi = {
180180
compile: bind(self, self.compile),
181-
comment:function(text) {return jqLite(document.createComment(text));},
182-
element:function(type) {return jqLite(document.createElement(type));},
183-
text:function(text) {return jqLite(document.createTextNode(text));},
184181
descend: function(value){ if(isDefined(value)) descend = value; return descend;},
185182
directives: function(value){ if(isDefined(value)) directives = value; return directives;},
186183
scope: function(value){ if(isDefined(value)) template.newScope = template.newScope || value; return template.newScope;}

src/markups.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ angularTextMarkup('{{}}', function(text, textNode, parentElement) {
3838
forEach(parseBindings(text), function(text){
3939
var exp = binding(text);
4040
if (exp) {
41-
newElement = self.element('span');
41+
newElement = jqLite('<span>');
4242
newElement.attr('ng:bind', exp);
4343
} else {
44-
newElement = self.text(text);
44+
newElement = jqLite(document.createTextNode(text));
4545
}
4646
if (msie && text.charAt(0) == ' ') {
4747
newElement = jqLite('<span>&nbsp;</span>');

src/widgets.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ angularWidget('a', function() {
890890
*/
891891
angularWidget("@ng:repeat", function(expression, element){
892892
element.removeAttr('ng:repeat');
893-
element.replaceWith(this.comment("ng:repeat: " + expression));
893+
element.replaceWith(jqLite("<!-- ng:repeat: " + expression + " --!>"));
894894
var template = this.compile(element);
895895
return function(reference){
896896
var match = expression.match(/^\s*(.+)\s+in\s+(.*)\s*$/),

0 commit comments

Comments
 (0)