template/cordova/lib/AppxManifest.js
function sortCapabilities (manifest) {

    // removes namespace prefix (m3:Capability -> Capability)
    // this is required since elementtree returns qualified name with namespace
    function extractLocalName (tag) {
        return tag.split(':').pop(); // takes last part of string after ':'
    }

    var capabilitiesRoot = manifest.find('.//Capabilities');
    var capabilities = capabilitiesRoot.getchildren() || [];
    // to sort elements we remove them and then add again in the appropriate order
    capabilities.forEach(function (elem) { // no .clear() method
        capabilitiesRoot.remove(elem);
        // CB-7601 we need local name w/o namespace prefix to sort capabilities correctly
        elem.localName = extractLocalName(elem.tag);
    });
    capabilities.sort(function (a, b) {
        return (a.localName > b.localName) ? 1 : -1;
    });
    capabilities.forEach(function (elem) {
        capabilitiesRoot.append(elem);
    });
}
function sortCapabilities (manifest) {

    // removes namespace prefix (m3:Capability -> Capability)
    // this is required since elementtree returns qualified name with namespace
    function extractLocalName (tag) {
        return tag.split(':').pop(); // takes last part of string after ':'
    }

    var capabilitiesRoot = manifest.find('.//Capabilities');
    var capabilities = capabilitiesRoot.getchildren() || [];
    // to sort elements we remove them and then add again in the appropriate order
    capabilities.forEach(function (elem) { // no .clear() method
        capabilitiesRoot.remove(elem);
        // CB-7601 we need local name w/o namespace prefix to sort capabilities correctly
        elem.localName = extractLocalName(elem.tag);
    });
    capabilities.sort(function (a, b) {
        return (a.localName > b.localName) ? 1 : -1;
    });
    capabilities.forEach(function (elem) {
        capabilitiesRoot.append(elem);
    });
}
function sortCapabilities ( manifest ) { // removes namespace prefix (m3:Capability -> Capability) // this is required since elementtree returns qualified name with namespace function extractLocalName ( tag ) { return tag . split ( ':' ) . pop ( ) ; // takes last part of string after ':' } var capabilitiesRoot = manifest . find ( './/Capabilities' ) ; var capabilities = capabilitiesRoot . getchildren ( ) || [ ] ; // to sort elements we remove them and then add again in the appropriate order capabilities . forEach ( function ( elem ) { // no .clear() method capabilitiesRoot . remove ( elem ) ; // CB-7601 we need local name w/o namespace prefix to sort capabilities correctly elem . localName = extractLocalName ( elem . tag ) ; } ) ; capabilities . sort ( function ( a , b ) { return ( a . localName > b . localName ) ? 1 : - 1 ; } ) ; capabilities . forEach ( function ( elem ) { capabilitiesRoot . append ( elem ) ; } ) ; }
Sorts 'capabilities' elements in manifest in ascending order
@param   {Elementtree.Document}  manifest  An XML document that represents
appxmanifest
Sorts capabilities elements in manifest in ascending order