Just a couple of thoughts:
constructor(wrapper, {direction:'above', getBoundingRect:null} = {}) {
this.wrapper = wrapper;
this.options = {direction, getBoundingRect}
this.pointer = wrapper.appendChild(elt('div', { class: prefix + '-pointer-' + this.dir + ' ' + prefix + '-pointer' }));
this.pointerWidth = this.pointerHeight = null;
this.dom = wrapper.appendChild(elt('div', { class: prefix }));
this.dom.addEventListener('transitionend', () => {
if (this.dom.style.opacity == '0')
this.dom.style.display = this.pointer.style.display = '';
});
this.isOpen = false;
this.lastLeft = this.lastTop = null;
}
//there doesn't really seem to be a reason NOT to just name this "direction"
get dir(){ return this.options.direction}
set dir(val){
if(val === this.options.direction) return;
this.options.direction = val;
}
....
// :: ()
// Remove the tooltip from the DOM.
detach() {
// DOES THE TRANSITION END LISTENER GET REMOVED AUTOMATICALLY?
this.dom.parentNode.removeChild(this.dom);
this.pointer.parentNode.removeChild(this.pointer);
}
Just a couple of thoughts: