Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
scrollparent
Advanced tools
The scrollparent npm package is a utility that helps you find the scrollable parent of a given DOM element. This can be useful in various scenarios where you need to determine the element responsible for scrolling, such as custom scroll handling, sticky elements, or infinite scrolling implementations.
Find Scroll Parent
This feature allows you to find the scrollable parent of a given DOM element. The code sample demonstrates how to use the scrollparent package to find and log the scrollable parent of an element with the ID 'myElement'.
const scrollParent = require('scrollparent');
const element = document.getElementById('myElement');
const parent = scrollParent(element);
console.log(parent);
The scroll-into-view-if-needed package not only helps in finding the scrollable parent but also provides functionality to scroll an element into view if it is not already visible. This package offers more comprehensive features for handling scroll behavior compared to scrollparent.
A function to get the scrolling parent of a html element.
npm install scrollparent --save
var Scrollparent = require("scrollparent");
Scrollparent(document.getElementById("content")) // HTMLHtmlElement or HTMLBodyElement as appropriate
var Scrollparent = require("scrollparent");
Scrollparent(document.getElementById("inside-a-scrolling-div")) // HTMLDivElement
Internally, the root scrolling element is determined in this library as the result of
document.scrollingElement || document.documentElement;
This should give a usable result in most browsers today
but if you want to ensure full support
you should use a document.scrollingElement
polyfill such as
this one.
MIT
FAQs
A function to get the scrolling parent of an html element.
The npm package scrollparent receives a total of 219,581 weekly downloads. As such, scrollparent popularity was classified as popular.
We found that scrollparent demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.