mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
[compiler] Added more control over how attributes are targeted to props
This commit is contained in:
parent
340b28804f
commit
57a94d6de0
@ -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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user