Latest Version: 2.0 RC 3 14 March 2017

Internal functions, objects, and variables

A good number of routines and values used by elementals.js are stored inside a self-instancing function so that they are not exposed user side. They are documented here for the purpose of those interested in helping maintain, sustain, or expand upon this project.

Again, none of these are exposed to the casual developer using this library.

Private Functions and Objects

function newAX(a)
A simple routine to wrap a 'new activeXObject' for use by the _.ajax routine, returning false of failure instead of throwing an error. This allows us to test for the most 'modern' available activeX equivalent to XMLHttpRequest
function ptAdd(e, p)
loops through Object p adding any elements found to object e if they do not already exist. Used to quickly add our polyfills as needed.
function eXMLHttp(h, x)
This is the actual internal functionality of our _.ajax routine. This is called via new so as to create a unique object instance of the function. This preserves our passed handler h object as well as our actual XMLHttpRequest x to be passed to our anonymous x.onreadystatechange function. Doing so allows us to fake the behavior of passing the actual ajax event as a parameter of the handler functions. Note that x is a non-existant parameter used so we don't have to say 'var' an extra time in the code.
function escFunc(m)
Used to safely escape certain character codes in the JSON.stringify polyfill for legacy IE. This was made a static function instead of an anonymous one for speed purposes given that, well... that polyfill is slow enough as it is.
function EventIE
As legacy IE passes events differently from, well... everyone else, by wrapping this in a function and calling it with "new EventIE" we are able to use an anonymous function to recreate the proper behavior multiple times. Notice that this routine also normalizes Event.target and Event.currentTarget.
function originalSort(a, b)
A static sorting function for _.uSortRestore that accesses data- properties created when a _.uSortElement is called for the first time.
function uSortTBODYe(e)
A static function to push the nodeText of an element onto our second internal temporary array. This is used as a callback to _.nodeEachChild by uSortTBODYRow to create the data list of cell contents.
function uSortTBODYRow(tr)
A static function to push a reference to a TR and the contents of its cells onto our primary internal temporary array. This is used as a callback to _.nodeEachChild by _.uSortElement when working on a TBODY.
function uSortLi(li)
This static function is passed as a callback to _.nodeEachChild by _.uSortElement when working on a UL or OL.
function dec() and function inc()
Internally elementals has a count variable that these increment/decrement. These functions are static so that they can be used as a faster callback than they would be if they were anonymous.
object msgLog
Contains the functions you can pass the names of to _.log for unified handling of error messages. Primarly used by _.ajax, but users can leverage _.log in their own projects as well.

Private variables

Many of these are stored static so that inside the loops of certain routines like JSON.stringify or String.stripCamel execution is sped up and the browser needs to spend less time on garbage collection when those routines end. Others are simply to allow data attributes to take less code, or to allow them to be easily changed should they conflict in a project with some other scripts data- attributes.

A list of known browser prefixes, used internally by the String.jsToCSSName method.
A list of characters that need special escape handling by escFunc and the JSON.stringify polyfill.
A regex to recognize certain characters that need escaping in escFunc and the JSON.stringify polyfill.
A simple match used by String.stripCamel
A more complex regex used by String.toCamel
A relatively complete string trimming regex, used by the polyfill for String.trim.
A white-list of valid locations the _.nodeAdd routine can place an element. Used by various routines such as eAttrSet to determine when/if _.nodeAdd should be called, or some other action should be taken instead.
The full name of the data attribute used by _.uSortElement and _.uSortRestore to track the original order of a table or list. Said attribute is attached to each TR or LI being sorted.
A data attribute indicating that a TBODY, OL or UL has been sorted. If this attribute does not exist on one of those tags, _.uSortRestore will exit without taking any action. If you cann _.uSortElement when this is not set, it will be added to the element and data-uSortOriginalPlace will be set on the appropriate sub-elements to store the original sort order.
The name of the data attribute used to store the target a BUTTON created by _.nodeAddSelectButton will select the contents of when clicked.
tList1 and tList2
Temporary internal lists used by various callbacks.
An internal counter also used during certain callbacks.