Contents
Ajax Base Object
Ajax - is a base namespace object for AJAX.OOP core library, which holds most of class hierarhy.
Methods
extend( destination, source)
Copy properties and methods of source object to destination object. Note that extending goes through copying of properties and methods so it’s NOT a kind of inheritance of prototypes.
Class( [parent,] declaration)
This method is a subject to implementation of OOP engine.
resolve()
Tries to resolve conflict in case of lost $ function. If native AJAX.OOP $ founction found - reassign it.
toggle()
Toggles between $ functions of different vendors.
toJson( Mixed obj)
Packs a given argument to JSON string.
Example: [run]
var obj = { x : 10, y : 11, z : { a: [1,2,3], s : "Hello, World!" } };
alert( Ajax.toJson( obj));
each( Array|Object obj, Function callback[, Boolean clean])
Implements a loop-run over the passed object or array, applying to each iteration passed callback function. Last optional argument clean - is a flag which turns on/off callback call on extended by library properties and methods.
Example: [run]
var obj = { x : 10, y : 11 };
Ajax.each( obj, function( key){
alert( key + ' = ' + obj[key]);
});
// or
var arr = [ 10, 11];
Ajax.each( arr, function( i){
alert( arr[i]);
});
clone( Mixed obj)
Creates a cope of a passed argument and returns it.
toQs( Object obj)
Packs passed object to a string having similar syntax to QUERY_STRING
isElement( Mixed obj)
Returns true if passed argument is a DOM Element, otherwise returns false.
isArray( Mixed obj)
Returns true if passed argument is an Array, otherwise returns false.
isFunction( Mixed obj)
Returns true if passed argument is a Function, otherwise returns false.
isRegExp( Mixed obj)
Returns true if passed argument is an instanceof RegExp, otherwise returns false.
isString( Mixed obj)
Returns true if passed argument is String, otherwise returns false.
isNumber( Mixed obj)
Returns true if passed argument is a Number, otherwise returns false.
isBoolean( Mixed obj)
Returns true if passed argument is Boolean, otherwise returns false.
isObject( Mixed obj)
Returns true if passed argument is an Object, otherwise returns false.
isNull( Mixed obj)
Returns true if a value of passed argument is null, otherwise returns false.
isUndefined( Mixed obj)
Returns true if passed argument is an undefined value, otherwise returns false.
isSimple( Mixed obj)
Returns true if passed argument is one of simple types: String, Boolean, Number or RegExp, otherwise returns false.
Properties
Version
Holds current version of AJAX.OOP library
Vendor
Holds name of a vendor of AJAX.OOP library. The value is ‘AJAX.OOP’
connections
Holds the total number of AJAX request connections during last page session.
debug
Turns on/off debugging mode for AJAX.OOP libary. Do not set it to true on a production srvers. Default is false - off.
isStrict
Holds the flag if browser CSS compatibility mode is turnet on to CSS1 compatibility (true) or not (false)
isSecure
Holds if current page opened under secure (HTTPS) connection (true) or not (false)
isOpera
This property is true if current browser application is Opera web browser, otherwise - false.
isChrome
This property is true if current browser application is Google Chrome, otherwise - false.
isWebKit
This property is true if current browser application is Apple WebKit based browser, otherwise - false.
isSafari
This property is true if current browser application is Apple Safari browser, otherwise - false.
isMobileSafari
This property is true if current browser application is Apple Safari browser for mobile devices, otherwise - false.
isIe
This property is true if current browser application is Microsoft Internet Explorer, otherwise - false.
isIe7
This property is true if current browser application is Microsoft Internet Explorer version 7, otherwise - false.
isGecko
This property is true if current browser application is Gecko engine based browser (Mozilla Firefox, Netscape Navigator, etc…), otherwise - false.
hasXPath
This property is true if current browser has XPath extention, otherwise - false.
hasElementExt
This property is true if current browser has HTMLElement extention, otherwise - false.
osWindows
This property is true if current operating system is Microsoft Windows family, otherwise - false.
osMac
This property is true if current operating system is Apple Mac OS family, otherwise - false.
osLinux
This property is true if current operating system is Linux family, otherwise - false.
