Index: third_party/polymer/v0_8/components-chromium/polymer/src/micro/properties-extracted.js |
diff --git a/third_party/polymer/v0_8/components-chromium/polymer/src/micro/properties-extracted.js b/third_party/polymer/v0_8/components-chromium/polymer/src/micro/properties-extracted.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5e861c3b4dac73b19bc3ad74d78879c56b110912 |
--- /dev/null |
+++ b/third_party/polymer/v0_8/components-chromium/polymer/src/micro/properties-extracted.js |
@@ -0,0 +1,92 @@ |
+ |
+ |
+ /** |
+ * 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; |
+ } |
+ |
+ }); |
+ |