Fix unintended usage of Polymer.Base. Replace Polymer.mixin with Object.assign.

This commit is contained in:
Kevin Schaaf
2017-03-03 14:14:00 -08:00
parent af0a04e2ff
commit 98d56befda
5 changed files with 9 additions and 27 deletions

View File

@@ -255,7 +255,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @return {Object} Target object that was passed as first argument.
*/
mixin(target, source) {
return Polymer.mixin(target, source);
for (let i in source) {
target[i] = source[i];
}
return target;
}
/**

View File

@@ -186,7 +186,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
flattenProperties({}, ownPropertiesForClass(klass));
let superCtor = Object.getPrototypeOf(klass.prototype).constructor;
if (superCtor.prototype instanceof PolymerElement) {
klass.__classProperties = Polymer.mixin(
klass.__classProperties = Object.assign(
Object.create(propertiesForClass(superCtor)),
klass.__classProperties);
}

View File

@@ -25,7 +25,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
'use strict';
const CaseMap = Polymer.CaseMap;
const mixin = Polymer.mixin;
// Monotonically increasing unique ID used for de-duping effects triggered
// from multiple properties in the same turn
@@ -390,8 +389,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
if (computeEffects) {
let inputProps = changedProps;
while (runEffects(inst, computeEffects, inputProps, oldProps, hasPaths)) {
mixin(oldProps, inst.__dataOld);
mixin(changedProps, inst.__dataPending);
Object.assign(oldProps, inst.__dataOld);
Object.assign(changedProps, inst.__dataPending);
inputProps = inst.__dataPending;
inst.__dataPending = null;
}
@@ -741,7 +740,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
// Merge child _hostProps into this _hostProps
if (n.templateContent) {
let templateHostProps = n.templateContent._hostProps;
Polymer.Base.mixin(hostProps, templateHostProps);
Object.assign(hostProps, templateHostProps);
}
}
return hostProps;

View File

@@ -38,26 +38,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
};
}
/**
* Copies props from a source object to a target object.
*
* Note, this method uses a simple `for...in` strategy for enumerating
* properties. To ensure only `ownProperties` are copied from source
* to target and that accessor implementations are copied, use `extend`.
*
* @memberof Polymer
* @method mixin
* @param {Object} target Target object to copy properties to.
* @param {Object} source Source object to copy properties from.
* @return {Object} Target object that was passed as first argument.
*/
Polymer.mixin = function(target, source) {
for (let i in source) {
target[i] = source[i];
}
return target;
};
/**
* Wraps an ES6 class expression mixin such that the mixin is only applied
* if it has not already been applied its base argument. Also memoizes mixin

View File

@@ -230,7 +230,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
// Mix any pre-bound data into __data; no need to flush this to
// instances since they pull from the template at instance-time
if (template.__dataProto) {
Polymer.mixin(template.__data, template.__dataProto);
Object.assign(template.__data, template.__dataProto);
}
// Clear any pending data for performance
template.__dataTemp = {};