Module core
module
core
The core module.
Project build number.
Full name of the project.
Short name of the framework, to be used in prefixes, class names etc.
URL of the project.
Project version.
An alias for document.getElementById
.
Usage example:
var domRef = o2.$('elementId');
An alias for Event.addEventListener(window, 'load',
callback)
.
Usage example:
o2.load(function() { initializeWidget(); });
A getElementsByName
wrapper.
Usage example:
var allTags = o2.n('username', 'testForm');
An empty function.
Acts similar to {link o2.n} -- with one exception: The method returns the first matched node, instead of returning a node collection.
Usage example:
var firstDiv = o2.nn('userprefs', 'testForm');
Exports the o2 namespace under a new name, so that it can be used together with an older version of o2.js
Usage example:
[script type="text/javascript" charset="UTF-8" src="o2.0.21.js"][/script] [script type="text/javascript" charset="UTF-8"] // Now "o2 v.0.21" can be accessed through o3 variable // (or window.o3). o2.noConflict('o3'); // Alternative usage without giving explicit namespace. myApp.o2 = o2.noConflict(); [/script] [script type="text/javascript" charset="UTF-8" src="o2.0.23.js"][/script]
Returns the unix time (i.e. the number of milliseconds since midnight of January 1, 1970)
Usage example:
var unixTimestamp = o2.now();
An alias for Dom.ready
.
Usage example:
o2.ready(function() { initializeWidget(); });
A getElementsByTagName
wrapper.
Usage example:
var allNodes = o2.t('*')
Property Details
property readonly String build
Project build number.
property readonly String longName
Full name of the project.
property readonly String name
Short name of the framework, to be used in prefixes, class names etc.
property readonly String url
URL of the project.
property readonly String version
Project version.
Function Details
function $
static
$(Object
obj)
An alias for document.getElementById
.
Usage example:
var domRef = o2.$('elementId');
obj
- the id to check. String
;
obj itself otherwise.
undefined
.function load
static
load(Function
callback)
An alias for Event.addEventListener(window, 'load',
callback)
.
Usage example:
o2.load(function() { initializeWidget(); });
callback
- The callback to execute when window is
loaded. function n
static
n(String
tagName, DOMNode
parent)
A getElementsByName
wrapper.
Usage example:
var allTags = o2.n('username', 'testForm');
tagName
- the name of the form item to search.
parent
- (optional defaults to document
)
the parent container, or the id of the parent container, to search. function nill
static
nill()
An empty function.
function nn
static
nn(String
name, DOMNode
parent)
Acts similar to {link o2.n} -- with one exception: The method returns the first matched node, instead of returning a node collection.
Usage example:
var firstDiv = o2.nn('userprefs', 'testForm');
name
- the name of the element to search.
parent
- (optional defaults to document
)
the parent container, or the id of the parent container, to search. null
otherwise.
function noConflict
static
noConflict(String
newName)
Exports the o2 namespace under a new name, so that it can be used together with an older version of o2.js
Usage example:
[script type="text/javascript" charset="UTF-8" src="o2.0.21.js"][/script] [script type="text/javascript" charset="UTF-8"] // Now "o2 v.0.21" can be accessed through o3 variable // (or window.o3). o2.noConflict('o3'); // Alternative usage without giving explicit namespace. myApp.o2 = o2.noConflict(); [/script] [script type="text/javascript" charset="UTF-8" src="o2.0.23.js"][/script]
newName
- (Optional; a random unique namespace will be
created if not given) the name of the new namespace. Object
.
function now
static
now()
Returns the unix time (i.e. the number of milliseconds since midnight of January 1, 1970)
Usage example:
var unixTimestamp = o2.now();
function ready
static
ready(Function
callback)
An alias for Dom.ready
.
Usage example:
o2.ready(function() { initializeWidget(); });
callback
- The callback to execute when DOM is
ready. function t
static
t(String
tagName, DOMNode
parent)
A getElementsByTagName
wrapper.
Usage example:
var allNodes = o2.t('*')
tagName
- the name of the tag to search.
parent
- (optional defaults to document
)
the parent container, or the id of the parent container, to search. function tt
static
tt(String
tagName, DOMNode
parent)
Acts similar to {link o2.t} -- with one exception: The method returns the first matched node, instead of returning a node collection.
Usage example:
var firstDiv = o2.tt('div', 'MasterContainer');
tagName
- the name of the tag to search.
parent
- (optional defaults to document
)
the parent container, or the id of the parent container, to search. null
otherwise.