summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser/resources/chromeos/login/gaia_input_form.js
blob: 811f08b989c7aa1139666a534129548a9d013f9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* Copyright 2015 The Chromium Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

Polymer('gaia-input-form', (function() {
  return {
    onButtonClicked: function() {
      this.fire('submit');
    },

    onKeyDown: function(e) {
      if (e.keyCode == 13 && !this.$.button.disabled)
        this.onButtonClicked();
    },

    set disabled(value) {
      var controls = this.querySelectorAll(
          ':host /deep/ [role="button"], :host /deep/ [is="core-input"]');
      for (var i = 0, control; control = controls[i]; ++i)
        control.disabled = value;
    },
  };
})());