Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
@material/dom
Advanced tools
DOM manipulation utilities for Material Components for the web
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';
See Importing the JS component for more information on how to import JavaScript.
The ponyfill
module provides the following functions:
Function Signature | Description |
---|---|
closest(element: Element, selector: string) => ?Element | Returns the ancestor of the given element matching the given selector (which may be the element itself if it matches), or null if no matching ancestor is found. |
matches(element: Element, selector: string) => boolean | Returns true if the given element matches the given CSS selector. |
External frameworks and libraries can use the following event utility methods.
Method Signature | Description |
---|---|
util.applyPassive(globalObj = window, forceRefresh = false) => object | Determine whether the current browser supports passive event listeners |
NOTE: The function
util.applyPassive
cache its results;forceRefresh
will force recomputation, but is used mainly for testing and should not be necessary in normal use.
FAQs
DOM manipulation utilities for Material Components for the web
The npm package @material/dom receives a total of 788,219 weekly downloads. As such, @material/dom popularity was classified as popular.
We found that @material/dom demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 15 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.