jessquery
Version:
Modern JavaScript is pretty good, but typing document.querySelector() is a pain. This is a tiny library that makes DOM manipulation easy. jQuery is around 80kb (30kb gzipped), while this is only around 8kb (3.5kb gzipped). Lots of JSDoc comments so it's s
37 lines (34 loc) • 923 B
HTML
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>TakeWhile Demo</title>
<style>
.highlight {
background-color: yellow;
}
</style>
</head>
<body>
<span>1</span>
<span>2</span>
<span>3</span>
<span>4</span>
<span>5</span>
<span>6</span>
<span>7</span>
<script type="module">
import { $$, $ } from "../index.js"
const elems = $$("span")
.css("border", "2px solid black")
.takeWhile((el) => parseInt(el.textContent) < 5)
.css("background-color", "yellow")
.do((el) => console.log(el.textContent))
.refresh()
.takeWhile((el) => parseInt(el.textContent) > 5, true)
.css("background-color", "pink")
.refresh()
</script>
</body>
</html>