Clarify warning. Add comment.

This commit is contained in:
Kevin Schaaf
2019-02-01 10:12:47 -08:00
parent 35c48d8952
commit 9dea1f780f

View File

@@ -2390,8 +2390,14 @@ export const PropertyEffects = dedupingMixin(superClass => {
* @protected * @protected
*/ */
static _addTemplatePropertyEffect(templateInfo, prop, effect) { static _addTemplatePropertyEffect(templateInfo, prop, effect) {
// `dynamicFns` is the flattened property list, so we can use that to
// detect non-declared properties. Properties must be listed in
// `properties` to be included in `observedAttributes` since CE V1
// reads that at registration time, and we want to keep template parsing
// lazy
if (legacyOptimizations && !(prop in templateInfo.dynamicFns)) { if (legacyOptimizations && !(prop in templateInfo.dynamicFns)) {
console.warn(`Property '${prop}' used in template but not declared in 'properties'.`); console.warn(`Property '${prop}' used in template but not declared in 'properties'; ` +
`attribute will not be observed.`);
} }
let hostProps = templateInfo.hostProps = templateInfo.hostProps || {}; let hostProps = templateInfo.hostProps = templateInfo.hostProps || {};
hostProps[prop] = true; hostProps[prop] = true;