From 57a94d6de0219972373f1a2692e500a90a9116cb Mon Sep 17 00:00:00 2001 From: Patrick Steele-Idem Date: Thu, 20 Apr 2017 13:53:45 -0600 Subject: [PATCH] [compiler] Added more control over how attributes are targeted to props --- compiler/ast/CustomTag.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/compiler/ast/CustomTag.js b/compiler/ast/CustomTag.js index ba21dacb7..339f9d026 100644 --- a/compiler/ast/CustomTag.js +++ b/compiler/ast/CustomTag.js @@ -259,6 +259,17 @@ class CustomTag extends HtmlElement { // to a property name. if (attrDef.targetProperty) { propName = attrDef.targetProperty; + if (Array.isArray(propName)) { + let propChain = propName; + if (propChain.length === 1) { + propName = propChain[0]; + } else if (propChain.length === 2) { + parentPropName = propChain[0]; + propName = propChain[1]; + } else { + throw new Error('Invalid "target-property". Expected array with two elements in the following form: ["PARENT_PROPERTY_NAME", "CHILD_PROPERTY_NAME"]'); + } + } } else if (attrDef.preserveName === true) { propName = attrName; } else {