diff --git a/lib/mixins/property-accessors.html b/lib/mixins/property-accessors.html index 90e521ff3b..030f32ec67 100644 --- a/lib/mixins/property-accessors.html +++ b/lib/mixins/property-accessors.html @@ -96,6 +96,7 @@ /** * @polymerMixinClass * @implements {Polymer_PropertyAccessors} + * @extends HTMLElement * @unrestricted */ class PropertyAccessors extends superClass { @@ -120,6 +121,14 @@ this._initializeProperties(); } + /** + * Implements native Custom Elements `attributeChangedCallback` to + * set an attribute value to a property via `_attributeToProperty`. + * + * @param {string} name Name of attribute that changed + * @param {?string} old Old attribute value + * @param {?string} value New attribute value + */ attributeChangedCallback(name, old, value) { if (old !== value) { this._attributeToProperty(name, value); @@ -214,8 +223,8 @@ * a typed value. * * @param {string} attribute Name of attribute to deserialize. - * @param {string} value of the attribute. - * @param {*} type type to deserialize to. + * @param {?string} value of the attribute. + * @param {*=} type type to deserialize to. */ _attributeToProperty(attribute, value, type) { // Don't deserialize back to property if currently reflecting @@ -306,8 +315,8 @@ * Note: The return value of `undefined` is used as a sentinel value to * indicate the attribute should be removed. * - * @param {string} value Attribute value to deserialize. - * @param {*} type Type to deserialize the string to. + * @param {?string} value Attribute value to deserialize. + * @param {*=} type Type to deserialize the string to. * @return {*} Typed value deserialized from the provided string. */ _deserializeValue(value, type) { @@ -326,7 +335,7 @@ case Object: try { - outValue = JSON.parse(value); + outValue = JSON.parse(/** @type string */(value)); } catch(x) { // allow non-JSON literals like Strings and Numbers } @@ -334,7 +343,7 @@ case Array: try { - outValue = JSON.parse(value); + outValue = JSON.parse(/** @type string */(value)); } catch(x) { outValue = null; console.warn(`Polymer::Attributes: couldn't decode Array as JSON: ${value}`); @@ -427,7 +436,8 @@ */ _setPendingProperty(property, value) { let old = this.__data[property]; - if (this._shouldPropertyChange(property, value, old)) { + let changed = this._shouldPropertyChange(property, value, old) + if (changed) { if (!this.__dataPending) { this.__dataPending = {}; this.__dataOld = {}; @@ -438,8 +448,8 @@ } this.__data[property] = value; this.__dataPending[property] = value; - return true; } + return changed; } /** diff --git a/lib/utils/boot.html b/lib/utils/boot.html index 0a15f5ed1d..6f5d993530 100644 --- a/lib/utils/boot.html +++ b/lib/utils/boot.html @@ -16,14 +16,14 @@ /** * @namespace Polymer * @summary Polymer is a lightweight library built on top of the web - * standards-based Web Components API's, and makes it easy to build your - * own custom HTML elements. + * standards-based Web Components API's, and makes it easy to build your + * own custom HTML elements. * @param {Object} info Prototype for the custom element. It must contain - * an `is` property to specify the element name. Other properties populate - * the element prototype. The `properties`, `observers`, `hostAttributes`, - * and `listeners` properties are processed to create element features. + * an `is` property to specify the element name. Other properties populate + * the element prototype. The `properties`, `observers`, `hostAttributes`, + * and `listeners` properties are processed to create element features. * @return {Object} Returns a custom element class for the given provided - * prototype `info` object. The name of the element if given by `info.is`. + * prototype `info` object. The name of the element if given by `info.is`. */ window.Polymer = function(info) { return window.Polymer._polymerFn(info); @@ -35,15 +35,20 @@ } // To be plugged by legacy implementation if loaded + /* eslint-disable valid-jsdoc */ /** * @param {Object} info Prototype for the custom element. It must contain - * an `is` property to specify the element name. Other properties populate - * the element prototype. The `properties`, `observers`, `hostAttributes`, - * and `listeners` properties are processed to create element features. + * an `is` property to specify the element name. Other properties populate + * the element prototype. The `properties`, `observers`, `hostAttributes`, + * and `listeners` properties are processed to create element features. + * @return {Object} Returns a custom element class for the given provided + * prototype `info` object. The name of the element if given by `info.is`. */ window.Polymer._polymerFn = function(info) { // eslint-disable-line no-unused-vars throw new Error('Load polymer.html to use the Polymer() function.'); } + /* eslint-enable */ + window.Polymer.version = '2.0.0'; /* eslint-disable no-unused-vars */