jellyfin-web/dashboard-ui/bower_components/iron-form-element-behavior/iron-form-element-behavior.html

87 lines
2.2 KiB
HTML
Raw Normal View History

2015-06-26 20:27:38 -07:00
<!--
@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
-->
<link rel="import" href="../polymer/polymer.html">
<script>
2015-07-08 17:20:01 -07:00
/**
2015-08-07 07:21:29 -07:00
Polymer.IronFormElementBehavior enables a custom element to be included
in an `iron-form`.
2015-07-08 17:20:01 -07:00
2015-06-26 20:27:38 -07:00
@demo demo/index.html
2015-07-08 17:20:01 -07:00
@polymerBehavior
2015-06-26 20:27:38 -07:00
*/
Polymer.IronFormElementBehavior = {
properties: {
2015-07-08 17:20:01 -07:00
/**
* Fired when the element is added to an `iron-form`.
*
* @event iron-form-element-register
*/
/**
* Fired when the element is removed from an `iron-form`.
*
* @event iron-form-element-unregister
*/
2015-06-26 20:27:38 -07:00
/**
* The name of this element.
*/
name: {
type: String
},
/**
* The value for this element.
*/
value: {
notify: true,
type: String
},
2015-07-08 17:20:01 -07:00
2015-08-07 07:21:29 -07:00
/**
* Set to true to mark the input as required. If used in a form, a
* custom element that uses this behavior should also use
* Polymer.IronValidatableBehavior and define a custom validation method.
* Otherwise, a `required` element will always be considered valid.
2015-12-14 08:43:03 -07:00
* It's also strongly recommended to provide a visual style for the element
* when its value is invalid.
2015-08-07 07:21:29 -07:00
*/
required: {
type: Boolean,
value: false
},
2015-07-08 17:20:01 -07:00
/**
2015-07-16 05:56:38 -07:00
* The form that the element is registered to.
2015-07-08 17:20:01 -07:00
*/
_parentForm: {
type: Object
}
2015-06-26 20:27:38 -07:00
},
attached: function() {
2015-07-16 05:56:38 -07:00
// Note: the iron-form that this element belongs to will set this
// element's _parentForm property when handling this event.
2015-06-26 20:27:38 -07:00
this.fire('iron-form-element-register');
2015-07-08 17:20:01 -07:00
},
detached: function() {
if (this._parentForm) {
this._parentForm.fire('iron-form-element-unregister', {target: this});
}
2015-06-26 20:27:38 -07:00
}
};
</script>