function getParents ( element , attribute ) { const ret = [ ] ; let parent = element . parentElement ; while ( true ) { if ( ! parent ) { break ; } if ( parent . hasAttribute ( attribute ) ) { ret . push ( parent ) ; } parent = parent . parentElement ; } return ret ; } export default getParents ;