Research
Security News
Malicious PyPI Package ‘pycord-self’ Targets Discord Developers with Token Theft and Backdoor Exploit
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
dom-query-helpers
Advanced tools
A super tiny DOM query helper library.
npm install dom-query-helpers
Note: This library is written as ES2015 code and published as such to
npm.
That means, code from dom-query-helpers
must not be excluded from
transpilation.
If you're using webpack and babel, that could look like:
{
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules\/(?!dom-query-helpers)/,
loader: 'babel-loader'
}
]
}
}
import { closest, matches, query } from 'dom-query-helpers';
closest(element: Element, selector: string): Element
Returns the closest ancestor of the element
(or the element
itself) which
matches the specified selector
.
If there isn't such an ancestor, it returns null
.
const closestParagraph = closest(element, 'p');
matches(element: Element, selector: string): boolean
Returns true
if the element
would be selected by the specified selector
,
false
otherwise.
const isParagraph = matches(element, 'p');
query(selector: string[, element: Element]): array
Returns an array
of elements matching the specified selector
which are
descendants of the document
or the element
specified as optional second
argument.
const paragraphs = query('p');
const spansInsideFirstParagraph = query('spans', paragraphs[0]);
Copyright (c) 2018 Jan Sorgalla. Released under the MIT license.
FAQs
A super tiny DOM query helper library.
The npm package dom-query-helpers receives a total of 1 weekly downloads. As such, dom-query-helpers popularity was classified as not popular.
We found that dom-query-helpers 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 the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.