Skip to content

lucaperret/gaspard-collection

Gaspard-collection

Manipulate collection of DOM elements

Gaspard-collection size Build Status Coverage Status

npm version devDependency Status Commitizen friendly

🔥 Use gaspard's Collection to queries elements and perform actions on each 🔥

Getting started

Installing

npm yarn bower  jsDelivr
npm install gaspard-collection yarn add gaspard-collection bower install gaspard-collection gaspard-collection.umd.js

Usage

Include gaspard-collection on your project

// Via ES2015 import statement
import GaspardCollection from 'gaspard-collection'

// or via Commonjs
const GaspardCollection = require('gaspard-collection')
const collection = new GaspardCollection('div.highlight')
collection
  .css('background-color', 'green')
  .find('p:first-child') // returns a new gaspard collection
  .addClass('introduction')
  .fadeIn(400)
  .elements // Array of matched elements
  .forEach(element => {
    console.log('div.highlight first paragraph', element)
  })

Or use gaspard-collection within a <script>

<script src="https://cdn.jsdelivr.net/npm/gaspard@latest/dist/gaspard.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gaspard-collection@latest/dist/gaspard-collection.umd.js"></script>
<script>
const collection = new GaspardCollection('div.highlight')
collection
  .css('background-color', 'green')
</script>

API documentation

Contribute

  • Fork the repository
  • Clone it locally and install dependencies with npm (or yarn)
    npm install
  • Create a new branch
  • Develop your feature/fix with tests running
    npm run test:watch
  • Commit, Push your branch and make a pull request on gaspard repository

Licensing

MIT License Copyright (c) 2017 Luca Perret

About

No description or website provided.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors