Created
December 13, 2016 15:01
-
-
Save themasch/f10f1994612109a0bafbeab6859c5202 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createElement(definition) { | |
var attributes = definition.attributes | |
if (typeof definition.elementName !== 'string') { | |
var Class = definition.elementName | |
if (Class.getMetadata) { | |
var oMetadata = Class.getMetadata() | |
var sDefaultAggregation = oMetadata._sDefaultAggregation | |
if (typeof sDefaultAggregation === 'string') { | |
if (attributes[sDefaultAggregation] !== undefined && definition.children.length === 1) { | |
attributes[sDefaultAggregation].template = definition.children[0] | |
} else { | |
attributes[sDefaultAggregation] = definition.children | |
} | |
} | |
} // else create a sap.ui.core.HTML? | |
return new Class(attributes); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment