Chromium Code Reviews| Index: chrome/browser/resources/settings/languages_page/edit_dictionary_page.js |
| diff --git a/chrome/browser/resources/settings/languages_page/edit_dictionary_page.js b/chrome/browser/resources/settings/languages_page/edit_dictionary_page.js |
| index 7dc1b199e61562f06e01337242f5b6bd1fbc4d33..6131db8dd6554fce076270d81065354ae315c4e8 100644 |
| --- a/chrome/browser/resources/settings/languages_page/edit_dictionary_page.js |
| +++ b/chrome/browser/resources/settings/languages_page/edit_dictionary_page.js |
| @@ -10,6 +10,9 @@ Polymer({ |
| is: 'settings-edit-dictionary-page', |
| properties: { |
| + /** @private {string} */ |
| + newWordValue: String, |
|
dpapad
2017/02/04 01:13:16
Nit (optional): Perhaps rename s/newWordValue/newW
scottchen
2017/02/06 18:44:01
I'm gonna keep this the same; I changed it to newW
|
| + |
| /** @private {!Array<string>} */ |
| words_: { |
| type: Array, |
| @@ -32,6 +35,15 @@ Polymer({ |
| }, |
| /** |
| + * Check if the new word text-field is empty. |
| + * @param {string} value |
| + * @return {bool} true if value is empty, false otherwise. |
|
dpapad
2017/02/04 01:13:16
This will blow up in compilation. s/bool/boolean.
scottchen
2017/02/06 18:44:01
Done.
|
| + */ |
| + isNewWordEmpty_: function(value) { |
|
dpapad
2017/02/04 01:13:16
I suggest not capturing the implementation details
scottchen
2017/02/06 18:44:01
Done.
|
| + return !value.trim(); |
| + }, |
| + |
| + /** |
| * Handles updates to the word list. Additions triggered by this element are |
| * de-duped so the word list remains a set. Words are appended to the end |
| * instead of re-sorting the list so it's clear what words were added. |
| @@ -82,8 +94,8 @@ Polymer({ |
| */ |
| addWordFromInput_: function() { |
| // Spaces are allowed, but removing leading and trailing whitespace. |
| - var word = this.$.newWord.value.trim(); |
| - this.$.newWord.value = ''; |
| + var word = this.newWordValue.trim(); |
| + this.newWordValue = ''; |
| if (!word) |
| return; |