js/odmwrapper/metadatawrapper.js
// TODO: .tagName approach could also be used for insertElementRef
.tagName approach could also be used for insertElementRef
. tagName approach could also be used for insertElementRef
function insertElementDef(elementDef) {
    const insertPositionDef = $$(elementDef.tagName).getLastElement();
    if (insertPositionDef) {
        insertPositionDef.insertAdjacentElement("afterend", elementDef);
    } else {
        if (elementDef.tagName == "CodeList") $("ItemDef") ? $$("ItemDef").getLastElement().insertAdjacentElement("afterend", elementDef) : $("MetaDataVersion").appendChild(elementDef);
        else if (elementDef.tagName == "ConditionDef") $("MethodDef") ? $("MethodDef").insertAdjacentElement("beforebegin", elementDef) : $("MetaDataVersion").appendChild(elementDef);
        else $("MetaDataVersion").appendChild(elementDef);
    }
}
function insertElementDef ( elementDef ) { const insertPositionDef = $$ ( elementDef . tagName ) . getLastElement ( ) ; if ( insertPositionDef ) { insertPositionDef . insertAdjacentElement ( "afterend" , elementDef ) ; } else { if ( elementDef . tagName == "CodeList" ) $ ( "ItemDef" ) ? $$ ( "ItemDef" ) . getLastElement ( ) . insertAdjacentElement ( "afterend" , elementDef ) : $ ( "MetaDataVersion" ) . appendChild ( elementDef ) ; else if ( elementDef . tagName == "ConditionDef" ) $ ( "MethodDef" ) ? $ ( "MethodDef" ) . insertAdjacentElement ( "beforebegin" , elementDef ) : $ ( "MetaDataVersion" ) . appendChild ( elementDef ) ; else $ ( "MetaDataVersion" ) . appendChild ( elementDef ) ; } }
TODO: .tagName approach could also be used for insertElementRef
TODO : . tagName approach could also be used for insertElementRef
// CodeLists must be inserted before Conditions and Conditions before Methods (the order of other elements is naturally preserved)