Remove propertyNameForAttribute since it's never needed.

This commit is contained in:
Steven Orvell
2017-11-29 11:01:02 -08:00
parent e09285dbf1
commit 8d57a6e91d
4 changed files with 54 additions and 91 deletions
+52 -40
View File
@@ -1,4 +1,24 @@
gulp-google-closure-compiler: externs/closure-types.js:941: WARNING - property disconnectedCallback not defined on any supertype of Polymer_LegacyElementMixin
gulp-google-closure-compiler: externs/closure-types.js:28: WARNING - property _generatePropertyAccessor on interface Polymer_PropertiesChanged is not implemented by type PropertiesChanged
Polymer_PropertiesChanged.prototype._generatePropertyAccessor = function(property, readOnly){};
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
externs/closure-types.js:124: WARNING - property _propertyForAttribute on interface Polymer_PropertiesChanged is not implemented by type PropertiesChanged
Polymer_PropertiesChanged.prototype._propertyForAttribute = function(attribute){};
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
externs/closure-types.js:129: WARNING - property _attributeForProperty on interface Polymer_PropertiesChanged is not implemented by type PropertiesChanged
Polymer_PropertiesChanged.prototype._attributeForProperty = function(property){};
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
externs/closure-types.js:133: WARNING - property _typeForProperty on interface Polymer_PropertiesChanged is not implemented by type PropertiesChanged
Polymer_PropertiesChanged.prototype._typeForProperty = function(name){};
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
externs/closure-types.js:144: WARNING - property __dataCounter on interface Polymer_PropertyAccessors is not implemented by type PropertyAccessors
Polymer_PropertyAccessors.prototype.__dataCounter;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
externs/closure-types.js:941: WARNING - property disconnectedCallback not defined on any supertype of Polymer_LegacyElementMixin
Polymer_LegacyElementMixin.prototype.disconnectedCallback = function(){};
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -6,63 +26,55 @@ polymer.html_script_10.js:6: WARNING - Type annotation references non-existent t
/** @const {!AsyncInterface} */
^^^^^^^^^^^^^^
polymer.html_script_14.js:59: WARNING - Type annotation references non-existent type PropertiesClassConstructor.
* @param {PropertiesClassConstructor} ctor PropertiesClass constructor
polymer.html_script_11.js:262: WARNING - Property _definePropertyAccessor never defined on base.prototype of type base.prototype
super._definePropertyAccessor(property, readOnly);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_13.js:1134: WARNING - Found two declarations for property __dataCounter on type PropertyEffects.
this.__dataCounter;
^^^^^^^^^^^^^^^^^^
polymer.html_script_14.js:56: WARNING - Type annotation references non-existent type PropertiesClassConstructor.
* @param {PropertiesClassConstructor} constructor PropertiesClass constructor
^^^^^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_14.js:60: WARNING - Type annotation references non-existent type PropertiesClassConstructor.
polymer.html_script_14.js:57: WARNING - Type annotation references non-existent type PropertiesClassConstructor.
* @return {PropertiesClassConstructor} Super class constructor
^^^^^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_14.js:63: WARNING - Type annotation references non-existent type PropertiesClassConstructor.
const proto = /** @type {PropertiesClassConstructor} */ (ctor).prototype;
polymer.html_script_14.js:60: WARNING - Type annotation references non-existent type PropertiesClassConstructor.
const proto = /** @type {PropertiesClassConstructor} */ (constructor).prototype;
^^^^^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_14.js:88: WARNING - Property _properties never defined on this of type PropertiesClass
polymer.html_script_14.js:72: WARNING - Type annotation references non-existent type PropertiesClassConstructor.
* @param {PropertiesClassConstructor} constructor PropertiesClass constructor
^^^^^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_14.js:98: WARNING - Property _properties never defined on this of type PropertiesClass
const props = this._properties;
^^^^^^^^^^^^^^^^
polymer.html_script_14.js:90: WARNING - Property prototype never defined on $jscomp$this of type PropertiesClass
return this.prototype._attributeForProperty(p);
^^^^^^^^^^^^^^
polymer.html_script_14.js:100: WARNING - Property attributeNameForProperty never defined on $jscomp$this of type PropertiesClass
return this.attributeNameForProperty(p);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_14.js:101: WARNING - parameter name does not appear in PropertiesClass.finalize's parameter list
static finalize() { // eslint-disable-line no-unused-vars
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_15.js:212: WARNING - Invalid type(s) for operator IN.
Expected : Object
Found : (PolymerElement|null)
polymer.html_script_14.js:135: WARNING - Property properties never defined on this of type PropertiesClass
const props = this.properties;
^^^^^^^^^^^^^^^
if (!info.readOnly && !(name in proto)) {
^^^^^
polymer.html_script_14.js:153: WARNING - Property _ownProperties never defined on this of type PropertiesClass
superCtor && superCtor._properties, this._ownProperties);
^^^^^^^^^^^^^^^^^^^
polymer.html_script_14.js:160: WARNING - Property prototype never defined on this of type PropertiesClass
const proto = this.prototype;
^^^^^^^^^^^^^^
polymer.html_script_14.js:161: WARNING - This property cannot be @const. The @const annotation is only allowed for properties of namespaces, prototype properties, static properties of constructors, and properties of the form this.prop declared inside constructors and prototype methods.
const attrInfo = this.__attributeInfo = {};
^^^^^^^^^^^^^^^^^^^^
polymer.html_script_14.js:162: WARNING - Property _properties never defined on this of type PropertiesClass{__attributeInfo: Object{}}
const props = this._properties;
^^^^^^^^^^^^^^^^
polymer.html_script_14.js:199: WARNING - Property localName never defined on this of type PropertiesClass{constructor: Function}
this.constructor.finalize(this.localName);
^^^^^^^^^^^^^^
polymer.html_script_15.js:232: WARNING - Property _finalizeClass never defined on polymerElementBase of type polymerElementBase<|function(new:polymerElementBase): ?|>
polymer.html_script_15.js:226: WARNING - Property _finalizeClass never defined on polymerElementBase of type polymerElementBase<|function(new:polymerElementBase): ?|>
super._finalizeClass();
^^^^^^^^^^^^^^^^^^^^
polymer.html_script_15.js:469: WARNING - Property connectedCallback never defined on polymerElementBase.prototype of type polymerElementBase.prototype
polymer.html_script_15.js:463: WARNING - Property connectedCallback never defined on polymerElementBase.prototype of type polymerElementBase.prototype
super.connectedCallback();
^^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_15.js:480: WARNING - The right side in the assignment is not a subtype of the left side.
polymer.html_script_15.js:474: WARNING - The right side in the assignment is not a subtype of the left side.
Expected : IObject<string,Element>
Found : IObject<string,Node>
@@ -73,4 +85,4 @@ polymer.html_script_9.js:57: WARNING - Type annotation references non-existent t
* @return {AsyncInterface} An async timeout interface
^^^^^^^^^^^^^^
0 error(s), 18 warning(s), 76.6% typed
0 error(s), 20 warning(s), 76.6% typed
-23
View File
@@ -545,29 +545,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}
}
/**
* Provides a default implementation of the standard Custom Elements
* `attributeChangedCallback`.
*
* By default, attributes declared in `properties` metadata are
* deserialized using their `type` information to properties of the
* same name. "Dash-cased" attributes are deserialized to "camelCase"
* properties.
*
* @param {string} name Name of attribute.
* @param {?string} old Old value of attribute.
* @param {?string} value Current value of attribute.
* @override
*/
attributeChangedCallback(name, old, value) {
if (old !== value) {
let property = this.constructor.propertyNameForAttribute(name);
if (!this._hasReadOnlyEffect(property)) {
super.attributeChangedCallback(name, old, value);
}
}
}
/**
* When using the ShadyCSS scoping and custom property shim, causes all
* shimmed styles in this element (and its subtree) to be updated
+2 -16
View File
@@ -68,21 +68,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}
}
/**
* Returns a property name that corresponds to the given attribute.
* The attribute name is always lowercase and the property name is the
* cased version for which a property accessor was created. Override to
* customize this mapping.
* @param {string} attribute Attribute to convert
* @return {string} Property name corresponding to the given attribute.
*
* @protected
*/
static propertyNameForAttribute(attribute) {
const map = this.prototype.__dataAttributes;
return map && map[attribute] || attribute;
}
/**
* Returns an attribute name that corresponds to the given property.
* The attribute name is the lowercased property name. Override to
@@ -401,7 +386,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*/
_attributeToProperty(attribute, value, type) {
if (!this.__serializing) {
const property = this.constructor.propertyNameForAttribute(attribute);
const map = this.__dataAttributes;
const property = map && map[attribute] || attribute;
this[property] = this._deserializeValue(value, type ||
this.constructor.typeForProperty(property));
}
-12
View File
@@ -125,18 +125,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}
}
/**
* Returns a property name that corresponds to the given attribute.
* By default, converts dash to camel case, e.g. `foo-bar` to `fooBar`.
* @param {string} attribute Attribute to convert
* @return {string} Property name corresponding to the given attribute.
*
* @protected
*/
static propertyNameForAttribute(attribute) {
return caseMap.dashToCamelCase(attribute);
}
/**
* Returns an attribute name that corresponds to the given property.
* By default, converts camel to dash case, e.g. `fooBar` to `foo-bar`.