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

Unified Diff: chrome/browser/resources/options/autofill_edit_creditcard_overlay.js

Issue 6258022: DOMUI: Fix AF CC field some more. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 | « no previous file | chrome/browser/resources/options/options_page.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options/autofill_edit_creditcard_overlay.js
diff --git a/chrome/browser/resources/options/autofill_edit_creditcard_overlay.js b/chrome/browser/resources/options/autofill_edit_creditcard_overlay.js
index 100f9316682959ef080daa23369a836c367aea7d..2a3b0eaf927c4ee8f1a746659f5b6cadd8be8fd1 100644
--- a/chrome/browser/resources/options/autofill_edit_creditcard_overlay.js
+++ b/chrome/browser/resources/options/autofill_edit_creditcard_overlay.js
@@ -46,9 +46,6 @@ cr.define('options', function() {
self.saveCreditCard_();
self.dismissOverlay_();
}
- $('creditCardNumber').onkeydown = this.onTextInput_.bind(this);
- $('creditCardNumber').addEventListener('textInput',
- this.onTextInput_.bind(this));
self.guid_ = '';
self.storedCCNumber_ = '';
@@ -59,27 +56,6 @@ cr.define('options', function() {
},
/**
- * Handles the textInput and keydown events.
- * @private
- */
- onTextInput_: function(event) {
- // For some reason, the textInput event doesn't consider
- // backspace/deletion an input event, so we have to handle those here.
- // 8 - backspace
- // 46 - delete
- if (event.type == 'keydown' && event.keyCode != '8' &&
- event.keyCode != '46')
- return;
-
- // If the user hasn't edited the text yet, delete it all on edit.
- if (!this.hasEditedNumber_ &&
- $('creditCardNumber').value != this.storedCCNumber_) {
- this.hasEditedNumber_ = true;
- $('creditCardNumber').value = '';
- }
- },
-
- /**
* Clears any uncommitted input, and dismisses the overlay.
* @private
*/
@@ -118,12 +94,9 @@ cr.define('options', function() {
* @private
*/
connectInputEvents_: function() {
- var self = this;
$('nameOnCard').oninput = $('creditCardNumber').oninput =
$('expirationMonth').onchange = $('expirationYear').onchange =
- function(event) {
- self.inputFieldChanged_();
- }
+ this.inputFieldChanged_.bind(this);
},
/**
@@ -131,9 +104,17 @@ cr.define('options', function() {
* button if all of the fields are empty.
* @private
*/
- inputFieldChanged_: function() {
+ inputFieldChanged_: function(event) {
var disabled = !$('nameOnCard').value && !$('creditCardNumber').value;
$('autoFillEditCreditCardApplyButton').disabled = disabled;
+
+ // If the user hasn't edited the text yet, delete it all on edit.
+ if (!this.hasEditedNumber_ &&
+ event && event.target == $('creditCardNumber') &&
arv (Not doing code reviews) 2011/01/26 19:27:35 Why would event be undefined?
arv (Not doing code reviews) 2011/01/26 19:27:35 Please create a var for $('creditCardNumber') so t
James Hawkins 2011/01/26 19:38:30 This method is called on overlay load w/out a para
James Hawkins 2011/01/26 19:38:30 Done.
arv (Not doing code reviews) 2011/01/26 20:00:41 Please rename the param to opt_event and document
James Hawkins 2011/01/26 21:31:36 Done.
+ $('creditCardNumber').value != this.storedCCNumber_) {
+ this.hasEditedNumber_ = true;
+ $('creditCardNumber').value = '';
+ }
},
/**
@@ -221,6 +202,7 @@ cr.define('options', function() {
this.inputFieldChanged_();
this.guid_ = creditCard['guid'];
this.storedCCNumber_ = creditCard['creditCardNumber'];
+ this.hasEditedNumber_ = $('creditCardNumber').value.length == 0;
},
};
« no previous file with comments | « no previous file | chrome/browser/resources/options/options_page.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698