Giter VIP home page Giter VIP logo

aria-attributes's Introduction

aria-attributes

Getter/setters for ARIA attributes

Installation

Install with component(1):

$ component install stephenmathieson/aria-attributes

API

Methods for space-delimited list of ID references

  • aria.controls(element, id)
  • aria.describedBy(element, id)
  • aria.flowTo(element, id)
  • aria.labelledBy(element, id)
  • aria.owns(element, id)

When id is provided, will update element's corresponding aria- attribute to include id. Will not clobber an existing value or re-add the same id.

When id is omitted, will return the current value of the corresponding aria- attribute.

Methods for boolean attributes

  • aria.atomic(element, value)
  • aria.busy(element, value)
  • aria.checked(element, value)
  • aria.disabled(element, value)
  • aria.expanded(element, value)
  • aria.grabbed(element, value)
  • aria.hasPopUp(element, value)
  • aria.hidden(element, value)
  • aria.multiline(element, value)
  • aria.multiSelectable(element, value)
  • aria.pressed(element, value)
  • aria.readOnly(element, value)
  • aria.required(element, value)
  • aria.selected(element, value)

Getter/setter for the element's corresponding aria- attribute. Will return a proper Boolean.

Methods for generic string attributes

  • aria.activeDescendant(element, str)
  • aria.dropEffect(element, str)
  • aria.label(element, str)
  • aria.live(element, str)
  • aria.relevant(element, str)
  • aria.sort(element, str)
  • aria.valueText(element, str)

Getter/setter for the element's corresponding aria- attribute.

Methods for number attributes

  • aria.level(element, num)
  • aria.posInSet(element, num)
  • aria.setSize(element, num)
  • aria.valueMax(element, num)
  • aria.valueMin(element, num)
  • aria.valueNow(element, num)

Getter/setter for the element's corresponding aria- attribute. Will return a Number.

Example Usage

var aria = require('aria-attributes');
var input = document.querySelector('input[name="username"]');

aria.describedBy(input, 'foo');
aria.describedBy(input, 'bar');

License

MIT

aria-attributes's People

Stargazers

Mike Slattery avatar Tony Kornmeier avatar Mel Roach avatar Matt Isner avatar

Watchers

Stephen Mathieson avatar James Cloos avatar

aria-attributes's Issues

id-ish methods should take an element reference

i feel like this would be pretty common:

var username = document.querySelector('input[name=username]')
var help = document.querySelector('.error .username')

aria.describedBy(username, help)

should add an id to the element reference if one is missing

constructor

var aria = require('aria-attributes');
var el = document.getElementById('foo');
aria(el).describedBy('bar')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.