0.0.9 • Published 10 months ago

@casd/dom-surfer v0.0.9

Weekly downloads
-
License
GPL-3.0-only
Repository
github
Last release
10 months ago

$('dom-surfer')

About

js-semistandard-style

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. 🌊🏄

Source lines of code (SLOC) comparison

Dom SurferjQuerySizzle (selector engine only)
2646,7671,539

Example

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.

Plain javascript

document.querySelectorAll('.js').forEach((element) => {
    if (Number(element.innerText) < 20) element.classList.add('bg-red');
});

Dom Surfer

import $ from '@casd/dom-surfer';
$('.ds').setClass('bg-red', ({ e }) => Number(e.innerText) < 20);

Copyright and license

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.

0.0.9

10 months ago

0.0.8

10 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago