param css param target return export function injectCSS ( css , target ) { const style = document . createElement ( "style" ) ; style . setAttribute ( "type" , "text/css" ) ; style . appendChild ( document . createTextNode ( css ) ) ; target . appendChild ( style ) ; return style ; } param element param selector return export function findClosestParent ( element , selector ) { let currentElement = element ; while ( currentElement && currentElement !== document ) { currentElement = currentElement . parentNode ; if ( ! ( currentElement instanceof Element ) ) { continue ; } if ( currentElement . matches ( selector ) ) { return currentElement ; } } return null ; }