Index: ui/file_manager/file_manager/foreground/js/ui/commandbutton.js |
diff --git a/ui/file_manager/file_manager/foreground/js/ui/commandbutton.js b/ui/file_manager/file_manager/foreground/js/ui/commandbutton.js |
index 570dc57c1c0edf981746762045e57b06b3e49512..60f8cc088f76745a7c2469d7ea1f66ce0e209a25 100644 |
--- a/ui/file_manager/file_manager/foreground/js/ui/commandbutton.js |
+++ b/ui/file_manager/file_manager/foreground/js/ui/commandbutton.js |
@@ -88,7 +88,7 @@ CommandButton.prototype.setCommand = function(command) { |
* @return {string} Button label. |
*/ |
CommandButton.prototype.getLabel = function() { |
- return this.textContent; |
+ return this.command_ ? this.command_.label : ''; |
}; |
/** |
@@ -96,7 +96,16 @@ CommandButton.prototype.getLabel = function() { |
* @param {string} label New button label. |
*/ |
CommandButton.prototype.setLabel = function(label) { |
- this.textContent = label; |
+ // Swap the textContent with current label only when this button doesn't have |
+ // any elements as children. |
+ // |
+ // TODO(fukino): If a user customize the button content, it becomes the |
+ // user's responsibility to update the content on command label's change. |
+ // Updating the label in customized button content should be done |
+ // automatically by specifying an element which should be synced with the |
+ // command label using class name or polymer's template binding. |
+ if (!this.firstElementChild) |
+ this.textContent = label; |
}; |
/** |