mirror of
https://github.com/Polymer/polymer.git
synced 2026-08-19 01:14:44 -05:00
Minor fixes
* [PropertiesChanged]: check for and call `super.attributeChangedCallback` * [PropertiesMixin]: * remove `disconnectedCallback` stub. * Improve comments
This commit is contained in:
@@ -369,11 +369,15 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
* @param {string} name Name of attribute that changed
|
||||
* @param {?string} old Old attribute value
|
||||
* @param {?string} value New attribute value
|
||||
* @suppress {missingProperties} Super may or may not implement the callback
|
||||
*/
|
||||
attributeChangedCallback(name, old, value) {
|
||||
if (old !== value) {
|
||||
this._attributeToProperty(name, value);
|
||||
}
|
||||
if (super.attributeChangedCallback) {
|
||||
super.attributeChangedCallback(name, old, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,15 +17,15 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Mixes `moreProps` into `props` but upgrades shorthand type
|
||||
* syntax to { type: Type}.
|
||||
*
|
||||
* @param {Object} props Properties to normalize
|
||||
* @return {Object} Copy of input `props` with normalized properties that
|
||||
* are in the form {type: Type}
|
||||
* @private
|
||||
*/
|
||||
function normalizeProperties(props) {
|
||||
* Creates a copy of `props` with each property normalized such that
|
||||
* upgraded it is an object with at least a type property { type: Type}.
|
||||
*
|
||||
* @param {Object} props Properties to normalize
|
||||
* @return {Object} Copy of input `props` with normalized properties that
|
||||
* are in the form {type: Type}
|
||||
* @private
|
||||
*/
|
||||
function normalizeProperties(props) {
|
||||
const output = {};
|
||||
for (let p in props) {
|
||||
const o = props[p];
|
||||
@@ -74,7 +74,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
// generated by this call to the mixin; the instanceof test only works
|
||||
// because the mixin is deduped and guaranteed only to apply once, hence
|
||||
// all constructors in a proto chain will see the same `PropertiesMixin`
|
||||
return (superCtor.prototype instanceof PropertiesMixin) ?
|
||||
return (superCtor.prototype instanceof PropertiesMixin) ?
|
||||
/** @type {PropertiesMixinConstructor} */ (superCtor) : null;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
* accessors exist on the element prototype. This method calls
|
||||
* `_finalizeClass` to finalize each constructor in the prototype chain.
|
||||
*/
|
||||
static finalize() {
|
||||
static finalize() {
|
||||
if (!this.hasOwnProperty(JSCompiler_renameProperty('__finalized', this))) {
|
||||
const superCtor = superPropertiesClass(/** @type {PropertiesMixinConstructor} */(this));
|
||||
if (superCtor) {
|
||||
@@ -200,16 +200,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
this._enableProperties();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the element is removed from a document
|
||||
* @suppress {missingProperties} Super may or may not implement the callback
|
||||
*/
|
||||
disconnectedCallback() {
|
||||
if (super.disconnectedCallback) {
|
||||
super.disconnectedCallback();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return PropertiesMixin;
|
||||
|
||||
Reference in New Issue
Block a user