Dom Surfer is a javascript library for selecting and operating on document object model
(DOM) elements in the browser.
This library is based on the native document.querySelectorAll() instead of for example
sizzle in the case of
jQuery.
Dom Surfer is designed to be a light-weight yet powerful way to interact with elements on
the web easily. 🌊🏄
| Dom Surfer | jQuery | Sizzle (selector engine only) |
|---|---|---|
| 264 | 6,767 | 1,539 |
This example illustrates a simple use case for setting a class on a set of DOM elements. Using Dom Surfer, what may take three lines of plain javascript can be a one-liner.
document.querySelectorAll('.js').forEach((element) => {
if (Number(element.innerText) < 20) {
element.classList.add('bg-red');
}
});import $ from '@casd/dom-surfer';
$('.ds').setClass('bg-red', ({ e }) => Number(e.innerText) < 20);Code and documentation copyright © 2024 Cas Dijkman. Code released under the GNU GPL version 3. Copies of the licenses can be found in the LICENSES directory.
This software is distributed as free software in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
