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

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: gets rid of confusing selector 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
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..421e78056ef2aadfda373c505ada3e9ee8c781a6 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,
+
/** @private {!Array<string>} */
words_: {
type: Array,
@@ -32,6 +35,16 @@ Polymer({
},
/**
+ * Check if the new word text-field is empty.
+ * @private
+ * @param {string} value
+ * @return {boolean} true if value is empty, false otherwise.
+ */
+ validateWord_: function(value) {
+ 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 +95,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;

Powered by Google App Engine
This is Rietveld 408576698