Commit 4e9d2904 authored by jhawkins@chromium.org's avatar jhawkins@chromium.org

DOMUI: Handle textInput in addition to keydown for the AF cc input field.

BUG=70452
TEST=none

Review URL: http://codereview.chromium.org/6274010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72591 0039d316-1c4b-4281-b951-d872f2087c98
parent 16d90292
......@@ -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',
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
// 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_) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment