jquery.attrs

0.1.2 • Public • Published

jquery.attrs

Codeship Status for thiagofesta/jquery.attrs Build Status TravisCI codecov.io coveralls.io bower.io npm Code Climate

jQuery plugin for getting attributes from jQuery collections.

Example

Given the HTML

<div id="element1" data-color="red" data-checked="true" ng-click="clickFn()" enabled></div>

And the Javascript

$('#element1').attrs();
/*
Outputs:
{
  'id': 'element1',
  'data-color': 'red',
  'data-checked': 'true',
  'ng-click': 'clickFn()',
  'enabled': ''
}
*/

Testing

First you need to install the dependencies

npm install
./node_modules/bower/bin/bower install

Now you are able to have the server up and running. Go and start the server

grunt server

Running tests

We have JSHint and Unit tests.

All of them can be run once using the following command

grunt test

You can see the coverage on the command line output or more details opening the test/coverage/index.html file on your browser.

Running JSHint

For running JSHint

grunt test:jshint
Running Unit Tests

For running unit tests

grunt test:unit

Building

For create a build run

grunt build

This task will also make sure all tests are passing before making the build.

Package Sidebar

Install

npm i jquery.attrs

Weekly Downloads

4

Version

0.1.2

License

MIT

Last publish

Collaborators

  • thiagofesta