function _insertBeforeFirst($container, selector, elem) {
    const foundElems = $container.find(selector);
    if (foundElems.length > 0) {
        foundElems.eq(0).before(elem);
    } else {
        $container.append(elem);
    }
}
function _insertBeforeFirst($container, selector, elem) {
    const foundElems = $container.find(selector);
    if (foundElems.length > 0) {
        foundElems.eq(0).before(elem);
    } else {
        $container.append(elem);
    }
}
function _insertBeforeFirst ( $container , selector , elem ) { const foundElems = $container . find ( selector ) ; if ( foundElems . length > 0 ) { foundElems . eq ( 0 ) . before ( elem ) ; } else { $container . append ( elem ) ; } }
Prepend the given element before the first existing element of same type.
This is generally used for loading Docma assets first (such as docma-web.js
and docma.css). Update: this is NOT used for scripts anymore, bec. jQuery
2.x duplicates the scripts. For scripts, we use our
`HtmlParser.DOM.insertBeforefirst()` method instead.
@private

@param {jQuery} $container - Container jQuery element.
@param {String} selector - Target element type selector. e.g. `"script"`.
@param {jQuery} elem - Element to be prepended.
Prepend the given element before the first existing element of same type . This is generally used for loading Docma assets first ( such as docma - web . js and docma . css ) . Update : this is NOT used for scripts anymore bec . jQuery 2 . x duplicates the scripts . For scripts we use our HtmlParser . DOM . insertBeforefirst () method instead . @private