new Dependent(args)
- Source:
Object representing an element that depends on other elements.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
args |
object | Object with the following keys (all of which are required)
Properties
|
Members
(static) comparisons
- Source:
Properties:
Name | Type | Description |
---|---|---|
RegExp |
function | |
Function |
function | |
Number |
function |
Comparison functions for comparing the value of an element with the
specification from the dependency settings. If the object type can't be
found in this list, the === operator is used by default.
Methods
checkConstraints(value, selectoropt, stateopt) → {bool}
- Source:
Checks whether the value matches the requirements for this constraint.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
value |
string | Array | object | Either the value of a state or an array/object of constraints. In the latter case, resolving the constraint continues. | |
selector |
string |
<optional> |
The selector for this constraint. If undefined, there isn't yet a selector that this constraint applies to. In that case, the state key is propagates to a selector and resolving continues. |
state |
Drupal.states.State |
<optional> |
The state to check for this constraint. If undefined, resolving continues. If both selector and state aren't undefined and valid non-numeric strings, a lookup for the actual value of that selector's state is performed. This parameter is not a State object but a pristine state string. |
Returns:
true or false, depending on whether this constraint is satisfied.
- Type
- bool
compare(reference, selector, state) → {bool}
- Source:
Compares a value with a reference value.
Parameters:
Name | Type | Description |
---|---|---|
reference |
object | The value used for reference. |
selector |
string | CSS selector describing the dependee. |
state |
Drupal.states.State | A State object describing the dependee's updated state. |
Returns:
true or false.
- Type
- bool
getDependees() → {object}
- Source:
Gathers information about all required triggers.
Returns:
An object describing the required triggers.
- Type
- object
initializeDependee(selector, dependeeStates)
- Source:
Initializes one of the elements this dependent depends on.
Parameters:
Name | Type | Description |
---|---|---|
selector |
string | The CSS selector describing the dependee. |
dependeeStates |
object | The list of states that have to be monitored for tracking the dependee's compliance status. |
reevaluate()
- Source:
Triggers change events in case a state changed.
update(selector, state, value)
- Source:
Update the value of a dependee's state.
Parameters:
Name | Type | Description |
---|---|---|
selector |
string | CSS selector describing the dependee. |
state |
Drupal.states.state | A State object describing the dependee's updated state. |
value |
string | The new value for the dependee's updated state. |
verifyConstraints(constraints, selector) → {bool}
- Source:
Evaluates child constraints to determine if a constraint is satisfied.
Parameters:
Name | Type | Description |
---|---|---|
constraints |
object | Array | A constraint object or an array of constraints. |
selector |
string | The selector for these constraints. If undefined, there isn't yet a selector that these constraints apply to. In that case, the keys of the object are interpreted as the selector if encountered. |
Returns:
true or false, depending on whether these constraints are satisfied.
- Type
- bool