src/TemplateEngine.js
/**
         * Ensures that a CSS payload has been added to the DOM
         * @param name
         */
Ensures that a CSS payload has been added to the DOM
@param name
Ensures that a CSS payload has been added to the DOM @param name
ensureCss(name) {
            if (this._css[name]) {
                const css = this._css[name],
                    id = css.markup.nodeType === undefined ? css.options.id || "okanjo-css-" + name : null; 
                if (id) {
                    const element = document.querySelector('#' + id.replace(/\./g, '\\.'));
                    if (!element) {
                        const head = document.head,
                            style = document.createElement('style');
                        style.id = id;
                        style.setAttribute('type', 'text/css');
                        if (style.hasOwnProperty) { 
                            style.innerHTML = css.markup;
                        } else {
                            style.styleSheet.cssText = css.markup;
                        }
                        if (head) {
                            head.appendChild(style);
                        } else {
                            const body = document.body;
                            if (body) {
                                body.appendChild(style);
                            } else {
                                okanjo.report('Cannot add CSS template to document. Does it not have a body or head?');
                            }
                        }
                    }
                }
            } else {
                okanjo.report('Attempted to add CSS template "'+name+'" to the DOM, however it does not appear to be registered?');
            }
        }
ensureCss ( name ) { if ( this . _css [ name ] ) { const css = this . _css [ name ] , id = css . markup . nodeType === undefined ? css . options . id || "okanjo-css-" + name : null ; if ( id ) { const element = document . querySelector ( '#' + id . replace ( / \. / g , '\\.' ) ) ; if ( ! element ) { const head = document . head , style = document . createElement ( 'style' ) ; style . id = id ; style . setAttribute ( 'type' , 'text/css' ) ; if ( style . hasOwnProperty ) { style . innerHTML = css . markup ; } else { style . styleSheet . cssText = css . markup ; } if ( head ) { head . appendChild ( style ) ; } else { const body = document . body ; if ( body ) { body . appendChild ( style ) ; } else { okanjo . report ( 'Cannot add CSS template to document. Does it not have a body or head?' ) ; } } } } } else { okanjo . report ( 'Attempted to add CSS template "' + name + '" to the DOM, however it does not appear to be registered?' ) ; } }
Ensures that a CSS payload has been added to the DOM
 @param name
Ensures that a CSS payload has been added to the DOM @param name
//noinspection JSValidateTypes // If it's a DOM element, just forget it cuz it's already on the page // Check for css element on page, if we have an ID to look for /* istanbul ignore else: old ie */ // old ie // NO HEAD, just prepend to body then // And if this doesn't work, just give up