Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/justeat/f-dom
Fozzie JS DOM queries library.
https://github.com/justeat/f-dom
fozzie ui
Last synced: about 1 month ago
JSON representation
Fozzie JS DOM queries library.
- Host: GitHub
- URL: https://github.com/justeat/f-dom
- Owner: justeat
- License: other
- Created: 2017-11-16T18:30:08.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-03T10:17:54.000Z (about 6 years ago)
- Last Synced: 2024-10-30T06:59:14.642Z (about 2 months ago)
- Topics: fozzie, ui
- Language: JavaScript
- Size: 204 KB
- Stars: 1
- Watchers: 46
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
---
[![npm version](https://badge.fury.io/js/%40justeat%2Ff-dom.svg)](https://badge.fury.io/js/%40justeat%2Ff-dom)
[![Build Status](https://travis-ci.org/justeat/f-dom.svg)](https://travis-ci.org/justeat/f-dom)
[![Coverage Status](https://coveralls.io/repos/github/justeat/f-dom/badge.svg)](https://coveralls.io/github/justeat/f-dom)
[![Known Vulnerabilities](https://snyk.io/test/github/justeat/f-dom/badge.svg?targetFile=package.json)](https://snyk.io/test/github/justeat/f-dom?targetFile=package.json)## Adding `f-dom` to your project
```bash
yarn add @justeat/f-dom
```Then, inside your script import `f-dom`.
```js
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.
```js
const element = $.first('.btn');
...
const element = $.first('#btn', '.container');
````all` method returns all elements in the DOM for the specified selector.
```js
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.
```js
const exists = $.exists('.btn');
...
const exists = $.exists('.btn', '.container');
```