MDC DOM provides commonly-used utilities for inspecting, traversing, and manipulating the DOM.
Most of the time, you shouldn’t need to depend on
mdc-dom directly. It is useful however if you’d like to write custom components that follow MDC Web’s pattern and elegantly integrate with the MDC Web ecosystem.
npm install @material/dom
import * as ponyfill from '@material/dom/ponyfill';
ponyfill module provides the following functions:
||Returns the ancestor of the given element matching the given selector (which may be the element itself if it matches), or
||Returns true if the given element matches the given CSS selector.|
External frameworks and libraries can use the following event utility methods.
||Determine whether the current browser supports passive event listeners|
NOTE: The function
util.applyPassivecache its results;
forceRefreshwill force recomputation, but is used mainly for testing and should not be necessary in normal use.