Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ariaUtilsArray.forEach(commonKeys, function (keySpec) {
// ---------------------------------------------- input arguments processing
if (ariaUtilsType.isString(keySpec)) {
keySpec = {name: keySpec};
}
var name = keySpec.name;
var shift = keySpec.shift;
if (shift == null) {
shift = false;
}
var granular = keySpec.granular;
if (granular == null) {
granular = false;
}
// -------------------------------------------------------------- processing
$constructor : function (input) {
// ------------------------------------------ input arguments processing
var spec;
if (ariaUtilsType.isString(input)) {
spec = {
name : input
};
} else {
spec = input;
}
// ---------------------------------------------------------- properties
this.parent = spec.parent;
this.name = spec.name;
this.trace = spec.trace;
// ------------------------------------------------- internal attributes
this.__tasks = [];
ariaUtilsArray.forEach(specs, function (spec) {
if (spec.children == null) {
// task --------------------------------------------------------
sequence.addTask(this.task(spec));
} else {
// sequence ----------------------------------------------------
var children = spec.children;
if (ariaUtilsType.isString(children)) {
children = this.scope[children];
}
if (ariaUtilsType.isFunction(children)) {
children = children.apply(this.scope, spec.args || []);
}
sequence.addSequence(this.sequence(spec.name, children));
}
}, this);
resolveMethod : function (spec) {
// ------------------------------------------------------ processing
if (ariaUtilsType.isString(spec)) {
spec = {
fn : spec
};
}
// args ------------------------------------------------------------
var args = spec.args;
// fn (registered properties) --------------------------------------
var fn = spec.fn;
if (fn == null) {
fn = spec.method;
}
}
// scope -----------------------------------------------------------
var scope = spec.scope;
if (scope == null) {
scope = registeredProperties.scope;
}
if (scope == null) {
scope = this.scope;
}
// fn (actual callback) --------------------------------------------
if (ariaUtilsType.isString(fn)) {
fn = scope[fn];
}
if (!ariaUtilsType.isFunction(fn)) {
throw new Error('Wrong function definition, got: ' + fn);
}
// asynchronous ----------------------------------------------------
var asynchronous = spec.asynchronous;
if (asynchronous == null) {
asynchronous = registeredProperties.asynchronous;
}
if (asynchronous == null) {
typeSequence : function (task, textSequence, delay) {
// -------------------------------------- input arguments processing
// textSequence ----------------------------------------------------
if (ariaUtilsType.isString(textSequence)) {
textSequence = [textSequence];
} else if (!ariaUtilsType.isArray(textSequence)) {
throw new Error('Invalid given textSequence. Should be an array or a string, got: ' + textSequence);
}
// delay -----------------------------------------------------------
if (delay == null) {
delay = this.defaultDelay;
}
// ------------------------------------------------------ processing
var tasks = [];
ariaUtilsArray.forEach(textSequence, function (text) {
tasks.push({
getGeometry : function (domElt) {
if (TypeUtils.isString(domElt)) {
domElt = this.getElementById(domElt);
}
return this.testWindow.aria.utils.Dom.getGeometry(domElt);
},
creator.call(this, function add(fnOrName) {
var fn;
if (ariaUtilsType.isString(fnOrName)) {
fn = self[fnOrName];
} else {
fn = fnOrName;
}
if (fn == null) {
throw new Error('The given value is not defined, cannot add any function.');
}
if (ariaUtilsType.isFunction(fn.async)) {
fn = fn.async;
}
if (arguments.length > 1) {
var boundArguments = Array.prototype.slice.call(arguments, 1);
fn = self._partializeAsynchronousFunction(fn, boundArguments);