diff options
| author | Pete Bacon Darwin | 2012-12-20 17:27:57 +0000 | 
|---|---|---|
| committer | Pete Bacon Darwin | 2013-01-09 09:22:35 +0000 | 
| commit | febb4c1c35cf767ae31fc9fef1f4b4f026ac9de0 (patch) | |
| tree | b921e64097110ae39e533cb8ff6e5329b9c4d9aa /test/testabilityPatch.js | |
| parent | 76a6047af690781b8238ba7924279470ba76d081 (diff) | |
| download | angular.js-febb4c1c35cf767ae31fc9fef1f4b4f026ac9de0.tar.bz2 | |
fix(jqLite): children() should only return elements
The jQuery implementation of children only returns child nodes of the given element that are elements themselves. The previous jqLite implementation was returning all nodes except those that are text nodes. Use jQLite.contents() to get all the child nodes.
The jQuery implementation of contents returns [] if the object has no child nodes.  The previous jqLite implementation was returning undefined, causing a stack overflow in test/testabilityPatch.js when it tried to `cleanup()` a window object.
The testabilityPatch was incorrectly using children() rather than contents() inside cleanup() to iterate down through all the child nodes of the element to clean up.
Diffstat (limited to 'test/testabilityPatch.js')
| -rw-r--r-- | test/testabilityPatch.js | 2 | 
1 files changed, 1 insertions, 1 deletions
| diff --git a/test/testabilityPatch.js b/test/testabilityPatch.js index ac22c72c..d55ff015 100644 --- a/test/testabilityPatch.js +++ b/test/testabilityPatch.js @@ -78,7 +78,7 @@ function dealoc(obj) {    function cleanup(element) {      element.unbind().removeData(); -    for ( var i = 0, children = element.children() || []; i < children.length; i++) { +    for ( var i = 0, children = element.contents() || []; i < children.length; i++) {        cleanup(jqLite(children[i]));      }    } | 
