Security News
UK Officials Consider Banning Ransomware Payments from Public Entities
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
@afontcu/kquery
Advanced tools
What's better than jQuery? 👉 kQuery 👈
kQuery is a a simplified jQuery-like capable library that helps you interact with your DOM in an old-fashioned way.
You can use this Codesandbox to play and explore kQuery!
npm install @afontcu/kquery
Then, you need to include kQuery to your project:
// using ES6 modules
import kQuery from '@afontcu/kquery'
// using CommonJS modules
const kQuery = require('@afontcu/kquery').default
you can also load directly from a browser, without needing a building step:
<script src="//unpkg.com/@afontcu/kquery@[VERSION]/dist/kquery.min.js"></script>
(make sure you change [VERSION] with the desired version, such as 0.1.0
).
kQuery(cssSelectorString)
Select matching elements on the page.
kCollection
or collection
in this assignment)<div class="item">Hello</div>
<div class="item">World!</div>
const kCollection = kQuery('.item')
kCollection
now contains the elements matching the CSS selector .item
.
kCollection.replaceWith(kCollection)
<div class="item">Some</div>
<div class="item">Item</div>
<span class="itemReplacement">Hello</span>
<span class="itemReplacement">World!</span>
kQuery('.item').replaceWith(kQuery('.itemReplacement'))
<span class="itemReplacement">Hello</span>
<span class="itemReplacement">World!</span>
kCollection.style(Object)
<div class="item">Hello World!</div>
kQuery('.item').style({ color: 'red' })
Hello World!
is now displayed in red color.
kCollection.remove()
<div class="item">Some</div>
<div class="item">Item</div>
<div>Hello World!</div>
kQuery('.item').remove()
<div>Hello World!</div>
kCollection.find(cssSelectorString)
<div class="item">Hello <span>World!</span></div>
<div class="item">World! <span>Hello</span></div>
const kCollection = kQuery('.item').find('span')
kCollection
contains two spawn elements.
kCollection.get()
Array
of all DOM elements in the kCollection
After this call, the kQuery
chain ends since you get a regular Array
and not a kCollection
.
<div class="item">Hello</div>
<div class="item">World!</div>
const domElements = kQuery('.item').get()
Result:
domElements
contains an array of DOM elements with two elements.
kQuery works in all modern browsers and Internet Explorer ≥ 11.
All contributions are welcomed!
Make sure you read our Contributing guide. Please notice that kQuery uses templates for the issues, so they will help you submit all the required information.
kQuery is MIT licensed.
FAQs
A simplified jQuery-like capable library
The npm package @afontcu/kquery receives a total of 7 weekly downloads. As such, @afontcu/kquery popularity was classified as not popular.
We found that @afontcu/kquery 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.
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.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.