scripts/loader-src.js
/**
     * Add node for loaded script or style in document header
     * @param {string} content script body
     * @param {string} url script or style url
     * */
Add node for loaded script or style in document header
@param {string} content script body
@param {string} url script or style url
Add node for loaded script or style in document header @param { string } content script body @param { string } url script or style url
appendScriptNode(content, url) {
        let extLength = 3;
        let scriptType = url.substring(url.length - extLength);
        if (scriptType === '.js') {
            let script = document.createElement('script');
            script.type = 'text/javascript';
            script.text = content;
            document.getElementsByTagName('head')[0].appendChild(script);
        } else if (scriptType === 'css') {
            let style = document.createElement('style');
            style.type = 'text/css';
            style.rel = 'stylesheet';
            style.media = 'screen, projection';
            if (style.styleSheet) {   
                style.styleSheet.cssText = content;
            } else {                
                let textnode = document.createTextNode(content);
                style.appendChild(textnode);
            }
            document.getElementsByTagName('head')[0].appendChild(style);
        }
    }
appendScriptNode ( content , url ) { let extLength = 3 ; let scriptType = url . substring ( url . length - extLength ) ; if ( scriptType === '.js' ) { let script = document . createElement ( 'script' ) ; script . type = 'text/javascript' ; script . text = content ; document . getElementsByTagName ( 'head' ) [ 0 ] . appendChild ( script ) ; } else if ( scriptType === 'css' ) { let style = document . createElement ( 'style' ) ; style . type = 'text/css' ; style . rel = 'stylesheet' ; style . media = 'screen, projection' ; if ( style . styleSheet ) { style . styleSheet . cssText = content ; } else { let textnode = document . createTextNode ( content ) ; style . appendChild ( textnode ) ; } document . getElementsByTagName ( 'head' ) [ 0 ] . appendChild ( style ) ; } }
Add node for loaded script or style in document header
 @param {string} content script body
 @param {string} url script or style url
Add node for loaded script or style in document header @param { string } content script body @param { string } url script or style url
// if loaded script // if loaded style // for IE // others