Clean up the names of methods for createDom from the post-closure rewrite
authorRobert Sesek <rsesek@bluestatic.org>
Wed, 28 Dec 2011 22:58:33 +0000 (17:58 -0500)
committerRobert Sesek <rsesek@bluestatic.org>
Wed, 28 Dec 2011 22:58:33 +0000 (17:58 -0500)
web_frontend/actor.js
web_frontend/path_control.js

index 9965625686e8efd662c49636a655267cc69c4a88..e9c10c0b7552bacd72fe53a9ec0f01882acc5b6a 100644 (file)
@@ -65,27 +65,24 @@ armadillo.Actor.optionStrings_ = {
   'download' : 'Download'
 };
 
-armadillo.Actor.prototype.createDom = function() {
-  this.decorateInternal($.createDom('div'));
-  return this.element_;
-};
-
 /**
- * Decorates the given element into a path control.
- * @param  {Element}  element
+ * Creates and sets the elemnt this object represents.
+ * @return  {Element}
  */
-armadillo.Actor.prototype.decorateInternal = function(element) {
-  this.element_ = element;
-  this.element_.addClass('actor');
-  this.element_.empty();
+armadillo.Actor.prototype.createDom = function() {
+  this.element_ = $.createDom('div').addClass('actor').empty();
   for (var option in armadillo.Actor.options_) {
     var tile = this.createTile_(option);
     if (tile) {
       this.element_.append(tile);
     }
   }
+
+
   this.controlContainer_ = $.createDom('div');
   this.element_.append(this.controlContainer_);
+
+  return this.element_;
 };
 
 /**
index 14bf946ead303f96e36a9e496caeb4dbd0f79e9e..57659a16b2cede06050715b75eedc53d2c5ad290 100644 (file)
@@ -70,9 +70,11 @@ armadillo.PathControl.prototype.getNameControl = function() {
 
 /**
  * Creates a new path control object.
+ * @returns  {Element}
  */
 armadillo.PathControl.prototype.createDom = function() {
-  this.decorateInternal($.createDom('div'));
+  this.element_ = $.createDom('div');
+  this.createDom_(this.element_);
   return this.element_;
 };
 
@@ -80,8 +82,7 @@ armadillo.PathControl.prototype.createDom = function() {
  * Decorates the given element into a path control.
  * @param  {Element}  element
  */
-armadillo.PathControl.prototype.decorateInternal = function(element) {
-  this.element_ = element;
+armadillo.PathControl.prototype.createDom_ = function(element) {
   var components = this.path_.split('/');
 
   // If this is an item that lives at the root, generate a special node for
@@ -96,7 +97,7 @@ armadillo.PathControl.prototype.decorateInternal = function(element) {
 
   var path = '';
   $.each(components, function (i, part) {
-    this.element_.append(this.createComponentNode_(path, part));
+    element.append(this.createComponentNode_(path, part));
     path = app.joinPath(path, part);
   }.bind(this));
 
@@ -113,7 +114,7 @@ armadillo.PathControl.prototype.decorateInternal = function(element) {
     this.nameControl_ = $.createDom('span').text(this.name_);
   }
 
-  this.element_.append(this.nameControl_);
+  element.append(this.nameControl_);
 };
 
 /**
@@ -185,7 +186,7 @@ armadillo.PathControl.prototype.fetchMenuContents_ = function(path, name, menu)
 armadillo.PathControl.prototype.componentChanged_ = function(e) {
   this.path_ = $(e.target).val();
   this.element_.empty();
-  this.decorateInternal(this.element_);
+  this.createDom_(this.element_);
 };
 
 /**