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.
Line clamp a DOM element in vanilla JavaScript
-webkit-line-clamp
…
)HTML:
<div class="line-clamp">
Lorem ipsum dolor sit amet, <strong>consectetur adipiscing</strong> elit.
</div>
CSS:
.line-clamp {
width: 100px;
line-height: 20px;
}
JavaScript:
const element = document.querySelector('.line-clamp')
lineClamp(element, 3)
Boom:
<div class="line-clamp" style="overflow: hidden; overflow-wrap: break-word; word-wrap: break-word;">
Lorem ipsum dolor sit amet, <strong>consectetur…</strong>
</div>
window.getComputedStyle
.const lineClamp = require('line-clamp')
Returns true
if text was truncated, else returns false
.
options
is an optional configuration object.
options.ellipsis
to change the string to be appended to the truncated text. Defaults to …
.See Usage.
$ yarn add line-clamp
FAQs
Line clamp a DOM element in vanilla JavaScript
The npm package line-clamp receives a total of 1,129 weekly downloads. As such, line-clamp popularity was classified as popular.
We found that line-clamp 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.