diff options
| author | Misko Hevery | 2012-05-09 19:27:15 -0400 |
|---|---|---|
| committer | Misko Hevery | 2012-05-17 10:36:45 -0700 |
| commit | acf095d1783e30e750d046ef24e81b5a0a31fbd4 (patch) | |
| tree | c77ebb4302b4399cd0fa04281ae01f2119da220d /test/testabilityPatch.js | |
| parent | 301d8f233b363b27c5e8ded009ee5fd875c174fc (diff) | |
| download | angular.js-acf095d1783e30e750d046ef24e81b5a0a31fbd4.tar.bz2 | |
fix(jqLite): have same expando format as jQuery
Diffstat (limited to 'test/testabilityPatch.js')
| -rw-r--r-- | test/testabilityPatch.js | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/test/testabilityPatch.js b/test/testabilityPatch.js index f033dda2..ac22c72c 100644 --- a/test/testabilityPatch.js +++ b/test/testabilityPatch.js @@ -40,9 +40,14 @@ afterEach(function() { // complain about uncleared jqCache references var count = 0; - forEachSorted(jqCache, function(value, key){ - count ++; - forEach(value, function(value, key){ + + // This line should be enabled as soon as this bug is fixed: http://bugs.jquery.com/ticket/11775 + //var cache = jqLite.cache; + var cache = JQLite.cache; + + forEachSorted(cache, function(expando, key){ + forEach(expando.data, function(value, key){ + count ++; if (value.$element) { dump('LEAK', key, value.$id, sortedHtml(value.$element)); } else { @@ -57,20 +62,25 @@ afterEach(function() { function dealoc(obj) { + var jqCache = jqLite.cache; if (obj) { if (isElement(obj)) { - var element = obj; - if (element.nodeName) element = jqLite(element); - if (element.dealoc) element.dealoc(); + cleanup(jqLite(obj)); } else { for(var key in jqCache) { var value = jqCache[key]; - if (value.$scope == obj) { + if (value.data && value.data.$scope == obj) { delete jqCache[key]; } } } + } + function cleanup(element) { + element.unbind().removeData(); + for ( var i = 0, children = element.children() || []; i < children.length; i++) { + cleanup(jqLite(children[i])); + } } } |
