diff options
| author | Misko Hevery | 2010-10-12 21:52:04 -0700 | 
|---|---|---|
| committer | Misko Hevery | 2010-10-12 21:52:04 -0700 | 
| commit | 2cb9497d02afdcfc19ea52fddcd6d1f04d81ffdb (patch) | |
| tree | 710de45537aa44509bb4064401f1f1592d8b48af /src | |
| parent | d9abfe8a7e488be8725f56077527b16f7c79546a (diff) | |
| download | angular.js-2cb9497d02afdcfc19ea52fddcd6d1f04d81ffdb.tar.bz2 | |
Fixed issue where compiler would pass in detached text node if previous markup would have removed it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Compiler.js | 26 | ||||
| -rw-r--r-- | src/markups.js | 2 | 
2 files changed, 12 insertions, 16 deletions
diff --git a/src/Compiler.js b/src/Compiler.js index a78a04c9..9263dc02 100644 --- a/src/Compiler.js +++ b/src/Compiler.js @@ -158,12 +158,17 @@ Compiler.prototype = {      }      if (descend){        // process markup for text nodes only -      eachTextNode(element, function(textNode){ -        var text = textNode.text(); -        foreach(self.markup, function(markup){ -          markup.call(selfApi, text, textNode, element); -        }); -      }); +      for(var i=0, child=element[0].childNodes; +          i<child.length; i++) { +        if (isTextNode(child[i])) { +          foreach(self.markup, function(markup){ +            if (i<child.length) { +              var textNode = jqLite(child[i]); +              markup.call(selfApi, textNode.text(), textNode, element); +            } +          }); +        } +      }      }      if (directives) { @@ -187,15 +192,6 @@ Compiler.prototype = {    }  }; -function eachTextNode(element, fn){ -  var i, chldNodes = element[0].childNodes || [], chld; -  for (i = 0; i < chldNodes.length; i++) { -    if(isTextNode(chld = chldNodes[i])) { -      fn(jqLite(chld), i); -    } -  } -} -  function eachNode(element, fn){    var i, chldNodes = element[0].childNodes || [], chld;    for (i = 0; i < chldNodes.length; i++) { diff --git a/src/markups.js b/src/markups.js index f63dd146..159d7b12 100644 --- a/src/markups.js +++ b/src/markups.js @@ -52,8 +52,8 @@ angularTextMarkup('{{}}', function(text, textNode, parentElement) {          cursor.after(newElement);          cursor = newElement;        }); +      textNode.remove();      } -    textNode.remove();    }  });  | 
