-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathiron-form-element-behavior.js
More file actions
49 lines (43 loc) · 1.58 KB
/
Copy pathiron-form-element-behavior.js
File metadata and controls
49 lines (43 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at
http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
part of the polymer project is also subject to an additional IP rights grant
found at http://polymer.github.io/PATENTS.txt
*/
import '@polymer/polymer/polymer-legacy.js';
/**
IronFormElementBehavior adds a `name`, `value` and `required` properties to
a custom element. It mostly exists for backcompatibility with Polymer 1.x, and
is probably not something you want to use.
@demo demo/index.html
@polymerBehavior
*/
export const IronFormElementBehavior = {
properties: {
/**
* The name of this element.
*/
name: {type: String},
/**
* The value for this element.
* @type {*}
*/
value: {notify: true, type: String},
/**
* Set to true to mark the input as required. If used in a form, a
* custom element that uses this behavior should also use
* IronValidatableBehavior and define a custom validation method.
* Otherwise, a `required` element will always be considered valid.
* It's also strongly recommended to provide a visual style for the element
* when its value is invalid.
*/
required: {type: Boolean, value: false},
},
// Empty implementations for backcompatibility.
attached: function() {},
detached: function() {}
};