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

Unified Diff: third_party/polymer/v1_0/components/iron-input/iron-input.html

Issue 1221923003: Update bower.json for Polymer elements and add PRESUBMIT.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 5 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: third_party/polymer/v1_0/components/iron-input/iron-input.html
diff --git a/third_party/polymer/v1_0/components/iron-input/iron-input.html b/third_party/polymer/v1_0/components/iron-input/iron-input.html
index 3d8cccbf70960058fce7f83680ae870c2978487e..da30882313b4e85e28c92eecb9a5db506ffc71bb 100644
--- a/third_party/polymer/v1_0/components/iron-input/iron-input.html
+++ b/third_party/polymer/v1_0/components/iron-input/iron-input.html
@@ -41,7 +41,7 @@ It may be desirable to only allow users to enter certain characters. You can use
is separate from validation, and `allowed-pattern` does not affect how the input is validated.
<!-- only allow characters that match [0-9] -->
- <input is="iron-input" prevent-invaild-input allowed-pattern="[0-9]">
+ <input is="iron-input" prevent-invalid-input allowed-pattern="[0-9]">
@hero hero.svg
@demo demo/index.html
@@ -154,11 +154,16 @@ is separate from validation, and `allowed-pattern` does not affect how the input
// always matches the charCode.
// None of this makes any sense.
- var nonPrintable =
+ // For these keys, ASCII code == browser keycode.
+ var anyNonPrintable =
(event.keyCode == 8) || // backspace
+ (event.keyCode == 13) || // enter
+ (event.keyCode == 27); // escape
+
+ // For these keys, make sure it's a browser keycode and not an ASCII code.
+ var mozNonPrintable =
(event.keyCode == 19) || // pause
(event.keyCode == 20) || // caps lock
- (event.keyCode == 27) || // escape
(event.keyCode == 45) || // insert
(event.keyCode == 46) || // delete
(event.keyCode == 144) || // num lock
@@ -166,7 +171,7 @@ is separate from validation, and `allowed-pattern` does not affect how the input
(event.keyCode > 32 && event.keyCode < 41) || // page up/down, end, home, arrows
(event.keyCode > 111 && event.keyCode < 124); // fn keys
- return !(event.charCode == 0 && nonPrintable);
+ return !anyNonPrintable && !(event.charCode == 0 && mozNonPrintable);
},
_onKeypress: function(event) {

Powered by Google App Engine
This is Rietveld 408576698