| Index: third_party/polymer/v0_8/components/polymer/src/micro/properties.html
|
| diff --git a/third_party/polymer/v0_8/components/polymer/src/micro/properties.html b/third_party/polymer/v0_8/components/polymer/src/micro/properties.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..79a3825f7c6f575b3e62e45341247cdf92c30a3e
|
| --- /dev/null
|
| +++ b/third_party/polymer/v0_8/components/polymer/src/micro/properties.html
|
| @@ -0,0 +1,102 @@
|
| +<!--
|
| +@license
|
| +Copyright (c) 2014 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
|
| +-->
|
| +<script>
|
| +
|
| + /**
|
| + * Define property metadata.
|
| + *
|
| + * properties: {
|
| + * <property>: <Type || Object>,
|
| + * ...
|
| + * }
|
| + *
|
| + * Example:
|
| + *
|
| + * properties: {
|
| + * // `foo` property can be assigned via attribute, will be deserialized to
|
| + * // the specified data-type. All `properties` properties have this behavior.
|
| + * foo: String,
|
| + *
|
| + * // `bar` property has additional behavior specifiers.
|
| + * // type: as above, type for (de-)serialization
|
| + * // notify: true to send a signal when a value is set to this property
|
| + * // reflectToAttribute: true to serialize the property to an attribute
|
| + * // readOnly: if true, the property has no setter
|
| + * bar: {
|
| + * type: Boolean,
|
| + * notify: true
|
| + * }
|
| + * }
|
| + *
|
| + * By itself the properties feature doesn't do anything but provide property
|
| + * information. Other features use this information to control behavior.
|
| + *
|
| + * The `type` information is used by the `attributes` feature to convert
|
| + * String values in attributes to typed properties. The `bind` feature uses
|
| + * property information to control property access.
|
| + *
|
| + * Marking a property as `notify` causes a change in the property to
|
| + * fire a non-bubbling event called `<property>-changed`. Elements that
|
| + * have enabled two-way binding to the property use this event to
|
| + * observe changes.
|
| + *
|
| + * `readOnly` properties have a getter, but no setter. To set a read-only
|
| + * property, use the private setter method `_set_<property>(value)`.
|
| + *
|
| + * @class base feature: properties
|
| + */
|
| +
|
| + // null object
|
| + Polymer.nob = Object.create(null);
|
| +
|
| + Polymer.Base._addFeature({
|
| +
|
| + properties: {
|
| + },
|
| +
|
| + getPropertyInfo: function(property) {
|
| + var info = this._getPropertyInfo(property, this.properties);
|
| + if (!info) {
|
| + this.behaviors.some(function(b) {
|
| + return info = this._getPropertyInfo(property, b.properties);
|
| + }, this);
|
| + }
|
| + return info || Polymer.nob;
|
| + },
|
| +
|
| + _getPropertyInfo: function(property, properties) {
|
| + var p = properties && properties[property];
|
| + if (typeof(p) === 'function') {
|
| + p = properties[property] = {
|
| + type: p
|
| + };
|
| + }
|
| + return p;
|
| + },
|
| +
|
| + getPropertyType: function(property) {
|
| + return this.getPropertyInfo(property).type;
|
| + },
|
| +
|
| + isReadOnlyProperty: function(property) {
|
| + return this.getPropertyInfo(property).readOnly;
|
| + },
|
| +
|
| + isNotifyProperty: function(property) {
|
| + return this.getPropertyInfo(property).notify;
|
| + },
|
| +
|
| + isReflectedProperty: function(property) {
|
| + return this.getPropertyInfo(property).reflectToAttribute;
|
| + }
|
| +
|
| + });
|
| +
|
| +</script>
|
|
|