Elementals.js

Latest Version: 3.7 Final 20 December 2018

Method Array.callbackAnd

Summary:

Iterates through an array passing a core element and the array indexed value to a callback, aborting the loop when a callback returns false.

Calling Convention:
Array.callbackAnd(Element, callback)
Parameters:
Element
An element passed to the callback
callback
The callback function to be called. Should return a boolean true or false. When a false is returned by the callback, iterating the array will cease.
Returns:
True if all Array elements were parsed
False if a callback returned loose false and execution was halted.

Example -- recursive search for class name

JavaScript


function classExists(element, names) {
	if (names instanceof Array)
		return names.callbackAnd(element, classExists);
	return RegExp('(\\s|^)' + n + '(\\s|$)').test(e.className);
}

Elementals Array Methods

Elementals Extensions

Polyfills

These link to the Mozilla Developer Network (MDN)

Property Key

  • Object
  • Method or Variable
  • "Constant" Variable

Downloads

Advertisement