diff options
Diffstat (limited to 'example/memoryLeak.html')
| -rw-r--r-- | example/memoryLeak.html | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/example/memoryLeak.html b/example/memoryLeak.html new file mode 100644 index 00000000..9e5f512d --- /dev/null +++ b/example/memoryLeak.html @@ -0,0 +1,55 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <script type="text/javascript" src="../lib/underscore/underscore.js"></script> + <script type="text/javascript" src="../lib/jquery/jquery-1.3.2.js"></script> + <script type="text/javascript" src="../src/angular-bootstrap.js"></script> + <script type="text/javascript"> + $(document).ready(function(){ + var scope = angular.compile(document); + scope.init(); + scope.set("add", function(){ + var partial = $("#partial"); + //id++; + partial.html('<div>{{ error() }}<br/></div>'); + var scope = angular.compile(partial); + scope.set("hello", function (){ + return 'who dat?'; + }); + scope.set("error", function (){ + this.misko.length; + }); + function XXXXXXXXX(){}; + scope.set('xxx', new XXXXXXXXX()); + scope.set("names", ["adam", "misko", "shyam"]); + scope.init(); + }); + scope.set("remove", function(){ + var partial = $("#partial"); + /* + partial.find('*').andSelf().each(function(){ + var scope = $(this).data('scope'); + if (scope) { + delete scope.state; + delete scope.widgets; + } + var cntl = $(this).data('controller'); + if (cntl) { + delete cntl.view; + } + $(this).removeData(); + }); + */ + partial.removeData('scope'); + partial.children().remove(); + }); + }); + </script> + <link rel="StyleSheet" type="text/css" href="../css/angular.css"/> + </head> + <body> + <input type="button" value="add" ng-click="add()"/> + <input type="button" value="remove" ng-click="remove()"/> + <div id="partial"></div> + </body> +</html> |
