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
-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`.