function advertorialUpdates()

in ArticleTemplates/assets/js/bootstraps/common.js [682:708]


function advertorialUpdates() {
    if (GU.opts.isAdvertising) {
        /**
         * Remove element with class 'meta'
         * if it's child element with class 'byline' is empty
         * and it has no children with class 'sponsorship'
         */
        let i;
        const metaContainers = document.getElementsByClassName('meta');

        for (i = 0; i < metaContainers.length; i++) {
            const metaContainer = metaContainers[i];
            const bylineElem = metaContainer.getElementsByClassName('byline')[0];

            if (bylineElem &&
                bylineElem.innerHTML === '' &&
                !metaContainer.getElementsByClassName('sponsorship').length) {
                const metaParent = metaContainer.parentNode;

                if (metaParent) {
                    metaParent.removeChild(metaContainer);
                }
            }

        }
    }
}