@justeat/f-dom

1.1.0 • Public • Published

f-dom

Fozzie Bear

Fozzie JS DOM queries library, built on top of the qwery selector engine.


npm version Build Status Coverage Status Known Vulnerabilities

Adding f-dom to your project

yarn add @justeat/f-dom

Then, inside your script import f-dom.

import $ from '@justeat/f-dom';

Usage

Each method has 2 parameters: mandatory selector and optional root. If root parameter is not specified, search will be performed for all elements in the DOM, otherwise, search will be performed for root child elements.

first method returns first element in the DOM for the specified selector.

const element = $.first('.btn');
...
const element = $.first('#btn', '.container');

all method returns all elements in the DOM for the specified selector.

const element = $.all('.btn');
...
const element = $.all('.btn', '.container');
...
const element = $('.btn'); // short syntax

exists method returns true, if at least one element exists in the DOM, otherwise returns false.

const exists = $.exists('.btn');
...
const exists = $.exists('.btn', '.container');

/@justeat/f-dom/

    Package Sidebar

    Install

    npm i @justeat/f-dom

    Weekly Downloads

    20

    Version

    1.1.0

    License

    Apache-2.0

    Unpacked Size

    7.85 kB

    Total Files

    5

    Last publish

    Collaborators

    • ilia.chikmarev
    • fidel.montesino
    • anastasiia.horban
    • raouf.sawehli
    • mmakwe-onyeka
    • gregory.palaci
    • arielfdr
    • dawidchar
    • roberto.santana
    • lizzie.turney
    • davidpn.11
    • dandel10n
    • mwh1989
    • kevinrodrigues
    • fozzie-bot
    • ashleynolan
    • simonsje
    • xander-marjoram
    • sergii.semenkiv
    • thomaswilliammcclean
    • benrwhite
    • robertellison
    • zlatin.ivanov
    • joshuang2332
    • oliversweb
    • andymayje
    • jamieomaguire
    • adammorr
    • lsphillips