UNPKG

@material-ui/popper.js

Version:

A fork of popper.js to avoid the deprecation warnings: https://github.com/mui-org/material-ui/issues/19358.

33 lines (28 loc) 989 B
import isModifierEnabled from '../utils/isModifierEnabled'; import getSupportedPropertyName from '../utils/getSupportedPropertyName'; /** * Destroys the popper. * @method * @memberof Popper */ export default function destroy() { this.state.isDestroyed = true; // touch DOM only if `applyStyle` modifier is enabled if (isModifierEnabled(this.modifiers, 'applyStyle')) { this.popper.removeAttribute('x-placement'); this.popper.style.position = ''; this.popper.style.top = ''; this.popper.style.left = ''; this.popper.style.right = ''; this.popper.style.bottom = ''; this.popper.style.willChange = ''; this.popper.style[getSupportedPropertyName('transform')] = ''; } this.disableEventListeners(); // remove the popper if user explicitly asked for the deletion on destroy // do not use `remove` because IE11 doesn't support it if (this.options.removeOnDestroy) { this.popper.parentNode.removeChild(this.popper); } return this; }