1.1.0 • Published 7 years ago
@justeat/f-dom v1.1.0
Adding f-dom to your project
yarn add @justeat/f-domThen, 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 syntaxexists method returns true, if at least one element exists in the DOM, otherwise returns false.
const exists = $.exists('.btn');
...
const exists = $.exists('.btn', '.container');