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

Side by Side Diff: chrome/browser/resources/chromeos/login/gaia_input.js

Issue 1129063003: <gaia-input> element extracted from <gaia-input-form>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Corrected test. Created 5 years, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 /* Copyright 2015 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
5
6 Polymer('gaia-input', (function() {
7 var INPUT_EMAIL_PATTERN = "^[a-zA-Z0-9.!#$%&'*+=?^_`{|}~-]+(@[^\\s@]+)?$";
8
9 return {
10 required: false,
11
12 ready: function() {
13 this.typeChanged();
14 },
15
16 onKeyDown: function(e) {
17 this.isInvalid = false;
18 },
19
20 setDomainVisibility: function() {
21 this.$.domainLabel.hidden = (this.type !== 'email') || !this.domain ||
22 (this.value.indexOf('@') !== -1);
23 },
24
25 onTap: function() {
26 this.isInvalid = false;
27 },
28
29 focus: function() {
30 this.$.input.focus();
31 },
32
33 checkValidity: function() {
34 var isValid = this.$.input.validity.valid;
35 this.isInvalid = !isValid;
36 return isValid;
37 },
38
39 typeChanged: function() {
40 if (this.type == 'email') {
41 this.$.input.pattern = INPUT_EMAIL_PATTERN;
42 this.$.input.type = 'text';
43 } else {
44 this.$.input.removeAttribute('pattern');
45 this.$.input.type = this.type;
46 }
47 this.setDomainVisibility();
48 },
49
50 valueChanged: function() {
51 this.setDomainVisibility();
52 },
53
54 domainChanged: function() {
55 this.setDomainVisibility();
56 }
57 };
58 })());
59
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/login/gaia_input.html ('k') | chrome/browser/resources/chromeos/login/gaia_input_form.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698