layout | tags |
---|---|
doc-api.html |
argument-list |
Determines if an element is :disabled
, or was disabled by ally.element.disabled
- i.e. the element is not focusable and editable.
Only form controls (<input>
, <select>
, <textarea>
, <button>
) and the <fieldset>
element know the disabled
attribute. While <fieldset disabled>
inherits the disabled
state onto descendant form controls, that does not affect the value of the descendant's disabled
property. Even the detection of inherited disabled
state via the :disabled
pseudo does not work reliably cross browser. To make matters worse, Internet Explorer 9 - 11 also support the disabled
state for <form>
elements, with the same inheritance scheme <fieldset>
provides.
var element = document.getElementById('victim');
var isDisabled = ally.is.disabled(element);
Name | Type | Default | Description |
---|---|---|---|
element | HTMLElement |
required | The Element to test. |
Boolean, true
if the element is disabled.
TypeError
if element
argument is not of type HTMLElement
.
- Since
v1.1.0
the<form disabled>
is handled properly in Internet Explorer 9 - 11.
- NOTE: The
<fieldset>
element can be disabled, inheriting the state onto all form elements it contains. - NOTE: WebKit and Blink do not properly support disabling
<fieldset tabindex="0" disabled>
elements themselves, while descendant form elements are properly disabled, see Blink 453847, Webkit 141086
-
ally.element.disabled
can disable any interactive element