Internal functions, objects, and variables
NONE of this is exposed to the casual developer using this library or to the global scope! They are documented here for the purpose of those interested in helping maintain, sustain, or expand upon this project.
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.
Private Functions and Objects
- function browserFix(target, methodName, altMethodName)
- This checks if the target Object has the named method. If so it returns true. It then checks to see if any browser specific prefixed equivalents are set, and if so will set the non-prefix version to that, returning true. If altMethodName is set, that too is checked for prefixed and non-prefixed versions, with methodName set to an alias, again returning true. This function returns false if no existing version was found under either name or combination of vendor prefixes.
- function eXMLHttp(h, x)
This is the actual internal functionality of our _.ajax routine. This is called via
newso as to create a unique object instance of the function. This preserves our passed handler h object as well as our actual
XMLHttpRequestx 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 makeSelectionButton(targetElement, buttonContent, buttonParent, placement, callback)
- Creates a button tag that when clicked will go to our callback function, placed using the same methods as Node.write. This is used internally by both Node.addCopyButton and Node.addSelectButton.
- 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
- function nCountBy(element, nodeMask, method, i)
- counts number of child nodes matching the mask. Used internally by _.Node.countAll and _.Node.countChildren
- function originalSort(a, b)
- A compare function designed for array user-sorts using the data- attributes created by _.USort.element.
- function polyfillAdd(targetObject, sources)
- loops through Object sources adding any elements found to object e if they do not already exist. Used to quickly add our polyfills as needed.
- function uSortTR(tr)
A static function to push a reference to a TR and the contents of its cells onto our primary internal temporary tempList Array. This is used as a callback to _.nodeEachChild by _.uSortElement when working on a
- function uSortLi(li)
This static function is passed as a callback to _.nodeEachChild by _.uSortElement when working on a
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.
- Alias of window
- Alias of document
Alias of document.body
- Alias of document.documentElement
A list of characters that need special escape handling by
escFuncand the JSON.stringify polyfill.
A regex to recognize certain characters that need escaping in
escFuncand the JSON.stringify polyfill.
- Is turned into a browser specific function for wrapping events to make sure that certain bits of functionality -- like IE handing passing events to the callback the same as other browsers, or the varying 'levels' of bubbling/propagation prevention -- are implemented in a uniform manner.
- Used internally as a reference to window.performance or our polyfill wrapper to 'fake' it.
- When the polyfill for window.performance and window.requestAnimationFrame is being used, this tracks the last time either routine was called.
- A simple match used by String.stripCamel
- A temporary array used when sorting UL, OL, or TBODY.
- A more complex regex used by String.toCamel
- A relatively complete string trimming regex, used by the polyfill for String.trim.
- Extra Undocumented Function Parameters?
- Some functions may have extra parameters attached to their declarations, these are treated as local variables by said functions so as to save a few bytes by not saying var. There is a SLIGHT performance gain from this approach, but really it's more about helping the minification and gzip compression do a better job.