Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Unified Diff: chrome/browser/resources/settings/languages_page/edit_dictionary_page.js

Issue 2670963003: MD Settings: in spell-check page, disable add button when input is empty. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/settings/languages_page/edit_dictionary_page.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « chrome/browser/resources/settings/languages_page/edit_dictionary_page.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698