0.1.2 • Published 6 years ago

ariaset v0.1.2

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

ariaset

Build Status Coverage Status

ariaset make easier assign for aria-" properties.

Install

$ yarn add ariaset -D

or

$ npm install ariaset -D

Usage

The recommend use case is using import statements.

import ariaset from 'ariaset';

const element = document.querySelector('.selector');

// set a property
ariaset(element, {
  label: 'description'
});

// get a property
ariaset(element, 'label');
// => description

// you can set multiple properties.
ariaset(element, {
  haspopup: 'listbox',
  expanded: false
});

// of course, you can get multiple properties.
ariaset(element, ['haspopup', 'expanded']);
// => { haspopup: 'listbox', expanded: false }

Alternatively, you can use script tag with html file.

<script src="node_modules/ariaset/dist/ariaset.js">
<script>
const element = document.querySelector('.selector');

ariaset(element {
  label: 'description'
});
</script>

Licence

MIT

Author

kzhrk