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

77 lines
1.7 KiB
HTML
Raw Normal View History

2015-06-26 23:27:38 -04: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">
<!--
Enables a custom element to be included in an `iron-form`.
-->
<script>
2015-07-08 20:20:01 -04:00
/**
2015-06-26 23:27:38 -04:00
@demo demo/index.html
2015-07-08 20:20:01 -04:00
@polymerBehavior
2015-06-26 23:27:38 -04:00
*/
Polymer.IronFormElementBehavior = {
properties: {
2015-07-08 20:20:01 -04: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 23:27:38 -04:00
/**
* The name of this element.
*/
name: {
type: String
},
/**
* The value for this element.
*/
value: {
notify: true,
type: String
},
2015-07-08 20:20:01 -04:00
/**
* Need to keep a reference to the form this element is registered
* to, so that it can unregister if detached.
*/
_parentForm: {
type: Object
}
2015-06-26 23:27:38 -04:00
},
attached: function() {
2015-07-08 20:20:01 -04:00
this._parentForm = Polymer.dom(this).parentNode;
2015-06-26 23:27:38 -04:00
this.fire('iron-form-element-register');
2015-07-08 20:20:01 -04:00
},
detached: function() {
if (this._parentForm) {
this._parentForm.fire('iron-form-element-unregister', {target: this});
}
2015-06-26 23:27:38 -04:00
}
};
</script>