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

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

Issue 6274010: DOMUI: Handle textInput in addition to keydown for the AF cc input field. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Handle delete too. 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 | no next file » | 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 ee29af77e031572788a5be2d33db1aa1c40305f3..100f9316682959ef080daa23369a836c367aea7d 100644
--- a/chrome/browser/resources/options/autofill_edit_creditcard_overlay.js
+++ b/chrome/browser/resources/options/autofill_edit_creditcard_overlay.js
@@ -46,7 +46,9 @@ cr.define('options', function() {
self.saveCreditCard_();
self.dismissOverlay_();
}
- $('creditCardNumber').onkeydown = this.onKeyDown_.bind(this);
+ $('creditCardNumber').onkeydown = this.onTextInput_.bind(this);
+ $('creditCardNumber').addEventListener('textInput',
arv (Not doing code reviews) 2011/01/26 18:17:07 Should this be 'input' like everywhere else?
+ this.onTextInput_.bind(this));
self.guid_ = '';
self.storedCCNumber_ = '';
@@ -57,10 +59,18 @@ cr.define('options', function() {
},
/**
- * Handles the keydown event.
+ * Handles the textInput and keydown events.
* @private
*/
- onKeyDown_: function(event) {
+ onTextInput_: function(event) {
+ // For some reason, the textInput event doesn't consider
arv (Not doing code reviews) 2011/01/26 18:17:07 The input event fires for all user changes to the
+ // backspace/deletion an input event, so we have to handle those here.
+ // 8 - backspace
+ // 46 - delete
+ if (event.type == 'keydown' && event.keyCode != '8' &&
arv (Not doing code reviews) 2011/01/26 18:17:07 FYI, keyCode is a Number so comparing it to a stri
+ 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_) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698