<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,6 @@
+== HEAD
+* Cleaned up internal methods, moved private function bodies to their respective public function
+
 == 1.2 - 3 November 2008
 * Added option 'default_state'
 * Expose additional functions: collapse, expand and toggleBranch</diff>
      <filename>acts_as_tree_table/CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -32,9 +32,7 @@
 	// plugin.
 	var options;
 	
-	// TableTree Plugin: display a tree in a table.
-	//
-	// TODO Look into possibility to add alternating row colors
+	// ActsAsTreeTable Plugin: display a tree in a table.
 	$.fn.acts_as_tree_table = function(opts) {
 		options = $.extend({}, $.fn.acts_as_tree_table.defaults, opts);
 		
@@ -72,54 +70,54 @@
 		tree_column: 0
 	};
 	
-	// Extend function to jQuery
+	// Recursively hide all children of a node.
 	$.fn.collapse = function() {
-  	collapse(this);
-	};
-
-	// Extend function to jQuery
-	$.fn.expand = function() {
-		expand(this);
-	};
-
-	// Extend function to jQuery
-	$.fn.toggleBranch = function() {
-		toggle(this);
-	};
-	
-	// === Private Methods
-	
-	// Select all children of a node.	
-	function children_of(node) {
-		return $(&quot;tr.child-of-&quot; + node[0].id);
-	};
-	
-	// Hide all descendants of a node.
-	function collapse(node) {
-		children_of(node).each(function() {
+		children_of($(this)).each(function() {
 			var child = $(this);
 
 			// Recursively collapse any descending nodes too
-			collapse(child);
-
+			child.collapse();
+			
 			child.hide();
 		});
 	};
-	
-	// Show all children of a node.
-	function expand(node) {
-		children_of(node).each(function() {
+
+	// Recursively show all children of a node.
+	$.fn.expand = function() {
+		children_of($(this)).each(function() {
 			var child = $(this);
 			
 			// Recursively expand any descending nodes that are parents which where
 			// expanded before too.
 			if(child.is(&quot;.expanded.parent&quot;)) {
-				expand(child);
+				child.expand();
 			}
 			
 			child.show();
 		});
 	};
+	
+	// Toggle an entire branch
+	$.fn.toggleBranch = function() {
+		var node = $(this);
+		
+		if(node.is(&quot;.collapsed&quot;)) {
+			node.removeClass(&quot;collapsed&quot;);
+			node.addClass(&quot;expanded&quot;);
+			node.expand();
+		}	else {
+			node.removeClass(&quot;expanded&quot;);
+			node.addClass(&quot;collapsed&quot;);
+			node.collapse();
+		}
+	};
+	
+	// === Private Methods
+	
+	// Select all children of a node.	
+	function children_of(node) {
+		return $(&quot;tr.child-of-&quot; + node[0].id);
+	};
 
 	// Add stuff to cell that contains stuff to make the tree collapsable.
 	function init_parent(node) {
@@ -140,7 +138,7 @@
 			// Otherwise the expander would not be visible in Safari/Webkit browsers.
 			cell.prepend('&lt;span style=&quot;margin-left: -' + options.indent + 'px; padding-left: ' + options.indent + 'px&quot; class=&quot;expander&quot;&gt;&lt;/span&gt;');
 			var expander = $(cell[0].firstChild);
-			expander.click(function() { toggle(node); });
+			expander.click(function() { node.toggleBranch(); });
 			
 			// Check for a class set explicitly by the user, otherwise set the default class
 			if( !(node.is(&quot;.expanded&quot;) || node.is(&quot;.collapsed&quot;)) ) {
@@ -149,25 +147,10 @@
 			
 			// Apply the default state
 			if(node.is(&quot;.collapsed&quot;)) {
-				collapse(node);
+				node.collapse();
 			} else if (node.is(&quot;.expanded&quot;)) {
-				expand(node);
+				node.expand();
 			}
 		}
 	};
-	
-	// Toggle a node
-	function toggle(node) {
-		if(node.is(&quot;.collapsed&quot;)) {
-			node.removeClass(&quot;collapsed&quot;);
-			node.addClass(&quot;expanded&quot;);
-			expand(node);
-		}
-		else {
-			node.removeClass(&quot;expanded&quot;);
-			node.addClass(&quot;collapsed&quot;);
-			collapse(node);
-		}
-	};
-	
 })(jQuery);
\ No newline at end of file</diff>
      <filename>acts_as_tree_table/src/jquery.acts_as_tree_table.js</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>cf0555d80f0dac75985a2cc01df4e1d23c5d6782</id>
    </parent>
  </parents>
  <author>
    <name>Ludo van den Boom</name>
    <email>ludo.vandenboom@cubicphuse.nl</email>
  </author>
  <url>http://github.com/ludo/jquery-plugins/commit/cb25e2a611bad6088997d9dbda83266060783dbd</url>
  <id>cb25e2a611bad6088997d9dbda83266060783dbd</id>
  <committed-date>2008-11-10T01:54:22-08:00</committed-date>
  <authored-date>2008-11-10T01:54:22-08:00</authored-date>
  <message>Cleaned up internal methods, moved private function bodies to their respective public function</message>
  <tree>b4e09fa151b715c792135541f5c8ce0c463d88ed</tree>
  <committer>
    <name>Ludo van den Boom</name>
    <email>ludo.vandenboom@cubicphuse.nl</email>
  </committer>
</commit>
