My Library Object Reference

This is the reference for the object-oriented interface, which is built on top of the functional API. Typically, each method wraps a single API function, though some (e.g. anchors) wrap multiple functions. The relationships between the two interfaces are cross-referenced for convenient comparison.

Note this document is a work in progress. We ask that you please bear with us.

C

See Also

The C function constructs an object that abstracts a form control. This constructor inherits from E.

Note to always use with the new operator if calling the constructor from an alternate frame. Creating C objects from form controls in alternate frames does not require the new operator.

Syntax

c = C([el]);
c = new C([el]);

Examples

var c = C('myid');
var c = C(F('myform').controls('myinput'));
window.alert('Value is ' + c.getValue());

changed (C)

See Also

Feature Detection

Deferred

Syntax

b = c.changed();

Examples

b = C('mycontrol').changed();

Return Value

The method returns a boolean.

getValue (C)

See Also

Feature Detection

Deferred

Syntax

value = c.getValue([default]);

Examples

value = C('myid').getValue();
defaultValue = C('myid').getValue(true);

Return Value

The method returns a string or array.

D

The D function constructs an object that abstracts a document.

Note to always use with the new operator if calling the constructor from an alternate frame. Creating D objects from documents in alternate frames does not require the new operator.

Syntax

d = D([doc]);
d = new D([doc]);

Examples

var d = D();
window.alert(d.isXHTML());
d = D(doc);
d.onReady(function() { window.alert('Ready'); });
d.on('click', function() { this.setScrollPosition(100, 0); });
var q = d.query('.testclass');

addStyleRule (D)

See Also

Feature Detection

Deferred

Syntax

d.addStyleRule(selector, rule[, media])

Examples

D().addStyleRule('.myclass', 'color:#ff0000');
D(doc).addStyleRule('.myclass', 'color:#ff0000');
D().addStyleRule('fieldset', 'display:none', 'print');

Return Value

The method returns the D object.

anchors (D)

See Also

Feature Detection

Deferred

Syntax

a = d.anchors([i]);

Examples

anchors = D().anchors();
anchors = D(doc).anchors();
anchor = D().anchors(0);
anchor = D().anchors('myname');

Return Value

The method returns an array (or array-like host object) or a element.

Note array-like host objects are live collections, so handle with results with care. Use the toArray function to convert to an array.

body (D)

See Also

Feature Detection

Deferred

Syntax

el = d.body();

Examples

el = D().body();
el = D(doc).body();

Return Value

The method returns a body element.

children (D)

See Also

Feature Detection

Deferred

Syntax

c = d.children([i]);

Examples

children = D().children();
children = D(doc).children();
child = D().children(0);

Return Value

Normally, the method returns an array or an element; but, if the index (i) is out of bounds, it will return undefined.

clientRectangle (D)

See Also

Feature Detection

Deferred

Syntax

r = d.clientRectangle();

Examples

r = D().clientRectangle();
r = D(doc).clientRectangle();

Return Value

The method returns an array containing the top, left, height and width of the viewport.

create (D)

See Also

Feature Detection

Deferred

Syntax

el = D().create(tag);

Examples

el = D().create('div');
el = D(doc).createElement('div');

Return Value

The method returns an element.

createWithAttributes (D)

See Also

Feature Detection

Deferred

Syntax

el = D().createWithAttributes(tag, atts);

Examples

el = D().createWithAttributes('div', { id:'me', 'class':'hello' });
el = D(doc).createWithAttributes('div', { id:'you', 'class':'hello' });

Return Value

The method returns an element.

createWithProperties (D)

See Also

Feature Detection

Deferred

Syntax

el = D(el).createWithProperties(tag, props);

Examples

el = D().createElementWithProperties('input', { type:'checkbox', checked:true });
el = D(doc).createElementWithProperties('input', { type:'checkbox', checked:true });

Return Value

The method returns an element.

deleteCookie (D)

See Also

Feature Detection

Deferred

Syntax

d.deleteCookie(name[, path]);

Examples

D().deleteCookie('test');
D(doc).deleteCookie('test');

Return Value

The method returns the D object.

descendants (D)

See Also

Feature Detection

Deferred

Syntax

e = d.descendants(tag[, i]);

Examples

els = D().descendants('*');
els = D(doc).descendants('*');
el = D().descendants('div', 0);

Return Value

Normally, the method returns an array (or array-like host object) or element; but, if the index (i) is out of bounds, it will return undefined.

Note array-like host objects are live collections, so handle with results with care. Use the toArray function to convert to an array.

forms (D)

See Also

Feature Detection

Deferred

Syntax

e = d.forms([i]);

Examples

els = D().forms();
els = D(doc).forms();
el = D().forms(0);
el = D().forms('myname');

Return Value

The method returns an array (or array-like host object) or a form element.

Note array-like host objects are live collections, so handle with results with care. Use the toArray function to convert to an array.

getCookie (D)

See Also

Feature Detection

Deferred

Syntax

s = d.getCookie(name[, defaultValue[, encoded]]);

Examples

c = D().getCookie('test');
c = D(doc).getCookie('test');
c = D().getCookie('test', '');

Return Value

The method returns a string or null.

getScrollPosition (D)

See Also

Feature Detection

Deferred

Syntax

p = d.getScrollPosition();

Examples

p = D().getScrollPosition();
p = D(doc).getScrollPosition();

Return Value

The method returns an array containing the top and left scroll positions or null if the position cannot be determined.

head (D)

See Also

Feature Detection

Deferred

Syntax

el = d.head();

Examples

el = D().head();
el = D(doc).head();

Return Value

The method returns a head element.

html (D)

See Also

Feature Detection

Deferred

Syntax

s = d.html([xhtml]);

Examples

html = D().html();
html = D(doc).html();
xhtml = D(doc).html(true);

Return Value

The method returns a string.

htmlElement (D)

See Also

Feature Detection

Deferred

Syntax

el = d.htmlElement();

Examples

el = D().htmlElement();
el = D(doc).htmlElement();

Return Value

The method returns an html element.

images (D)

See Also

Feature Detection

Deferred

Syntax

e = d.images([i]);

Examples

els = D().images();
els = D(doc).images();
el = D().images(0);
el = D().images('myname');

Return Value

The method returns an array (or array-like host object) or img element.

Note array-like host objects are live collections, so handle with results with care. Use the toArray function to convert to an array.

isXhtml (D)

See Also

Feature Detection

Deferred

Syntax

b = d.isXhtml();

Examples

b = D().isXhtml();
b = D(doc).isXhtml();

Return Value

The method returns a boolean value.

links (D)

See Also

Feature Detection

Deferred

Syntax

e = d.links([i]);

Examples

els = D().links();
els = D(doc).links();
el = D().links(0);
el = D().links('myname');

Return Value

The method returns an array (or array-like host object) or a element.

Note array-like host objects are live collections, so handle with results with care. Use the toArray function to convert to an array.

load (D)

See Also

Feature Detection

Deferred

Syntax

d.load(doc);

Examples

D().load(doc);

Return Value

The method returns the D object.

node (D)

See Also

Feature Detection

Deferred

Syntax

doc = d.node();

Examples

doc = D().node();

Return Value

The method returns a document.

off (D)

See Also

Feature Detection

Deferred

Syntax

d.off(ev, fn);

Examples

D().off('click', fn);
D(doc).off('click', fn);

Return Value

The method returns the D object

on (D)

See Also

Feature Detection

Deferred

Syntax

d.on(ev, fn[, context]);

Examples

D().on('click', function() { window.alert('Hello again!'); });
D().on('click', function() { this.doSomething(); }, someObject);
D(doc).on('click', function() { this.doSomethingElse(); }, someObject);

Return Value

The method returns the D object

onReady (D)

See Also

Feature Detection

Deferred

Syntax

d.onReady(fn);

Examples

D(doc).onReady(function() { doSomething(); });
D(docOther).onReady(function() { doSomethingElse(); });

Return Value

The method returns the D object

query (D)

See Also

Feature Detection

Deferred

Syntax

q = d.query(selector);

Examples

q = D().query('div');
q = D(doc).query('div');
q = D().query('div div div');
q = D().query('.myclass');
q = D().query('#myid');
q = D().query('#myid p.myclass');
q = D().query('div:first-child');
q = D().query('div:only-child');
q = D().query('div:nth-child(5)');
q = D().query('h2 + div');
q = D().query('h2 + div#myid');
q = D().query('h2 ~ div#myid');

Return Value

The method returns a Q object.

scrollRectangle (D)

See Also

Feature Detection

Deferred

Syntax

r = d.scrollRectangle();

Examples

r = D().scrollRectangle();
r = D(doc).scrollRectangle();

Return Value

The function returns an array containing the top, left, height and width of the top-level rendered element (HTML or body).

scrollSize (D)

See Also

Feature Detection

Deferred

Syntax

r = d.scrollSize();

Examples

r = D().scrollRectangle();
r = D(doc).scrollRectangle();

Return Value

The function returns an array containing the height and width of the top-level rendered element (HTML or body).

setActiveStyleSheet (D)

See Also

Feature Detection

Deferred

Syntax

d.setActiveStyleSheet(id);

Examples

D().setActiveStyleSheet('winter');
D(doc).setActiveStyleSheet('winter');
D().setActiveStyleSheet('summer');

Return Value

The method returns the D object

setCookie (D)

See Also

Feature Detection

Deferred

Syntax

d.setCookie(name, value[, expires[, path[, secure]]]);

Examples

D().setCookie('myname', 'myvalue');
D(doc).setCookie('myname', 'myvalue');
D().setCookie('myname', 'myvalue', 7); // Expires in 7 days

Return Value

The method returns the D object

setScrollPosition (D)

See Also

Feature Detection

Deferred

Syntax

d.setScrollPosition(top, left[, isNormalized[, options[, callback]]]);

Examples

D().setScrollPosition(el, 0, 0);
D(doc).setScrollPosition(el, 0, 0);

Return Value

The method returns the D object

window (D)

See Also

Feature Detection

Deferred

Syntax

win = d.window();

Examples

win = D().window();
win = D(doc).window();

Return Value

The method returns a window object.

E

See Also

The E function constructs an object that abstracts an element.

Note to always use with the new operator if calling the constructor from an alternate frame. Creating E objects from elements in alternate frames does not require the new operator.

Syntax

e = E(id);
e = new E(id);

Examples

var e = E(API.getHtmlElement());
e.onHelp(function() { window.alert('Help') }).onContextClick(function() { window.alert('Context click') });
e.load('testid');
e.fadeIn({ duration:1000 }).on('click', function() { window.alert('Clicked'); });
E().loadHtml('<div><strong>This is a test<\/strong><\/div>').appendTo(document.body);

absolute (E)

Feature Detection

Deferred

Syntax

e.absolute();

Examples

E('myid').absolute();
E(el).absolute();

Return Value

The method returns the E object.

addClass (E)

Feature Detection

Immediate

Syntax

e.addClass(className);

Examples

E('myid').addClass('myclass');
E(el).addClass('myclass');

Return Value

The method returns the E object.

addHtml (E)

Feature Detection

Deferred

Syntax

e.addHtml(html);

Examples

E('myid').addHtml('<p>This is a test</p>');
E(el).addHtml('<p>This is also a test</p>');

Return Value

The method returns the E object.

addText (E)

Feature Detection

Immediate

Syntax

e.addText(text);

Examples

E('myid').addText('Burma-Shave');
E(el).addText('Burma-Shave');

Return Value

The method returns the E object.

adjacent (E)

Feature Detection

Deferred

Syntax

e.adjacent(el[, side]);

Examples

E('myid').adjacent(el);
E(el).adjacent(el2);
E('myid').adjacent(el, 'right');
E('myid').adjacent(el, 'top');

Return Value

The method returns the E object.

appendTo (E)

Feature Detection

Immediate

Syntax

e.appendTo(el);

Examples

E('myid').appendTo(el);
E(el).appendTo(elContainer);

Return Value

The method returns the E object.

attachDrag (E)

Feature Detection

Deferred

Syntax

e.attachDrag([elHandle[, options]]);

Examples

E('myid').attachDrag();
E(el).attachDrag();
E(el).attachDrag(elHandle, { ondrop: function() { window.alert('Dropped!' } });

Return Value

The method returns the E object.

border (E)

Feature Detection

Immediate

Syntax

w = e.border(side);

Examples

i = E('myid').border('right');
i = E(el).border('right');
i = E('myid').border('top');

Return Value

The method returns a number of pixels.

borders (E)

Feature Detection

Immediate

Syntax

o = e.borders();

Examples

o = E('myid').borders();
o = E(el).borders();

Return Value

The method returns an object with properties named for each side (top, left, bottom and right), containing a number of pixels.

center (E)

Feature Detection

Deferred

Syntax

e.center([options[, callback]]);

Examples

E(el).center();
E('myid').center();
E(el).center({ duration:1000, ease:API.ease.circle });
E(el).center({ duration:1000, ease:API.ease.circle }, fn);

Return Value

The method returns the E object.

children (E)

Feature Detection

Immediate

Syntax

c = e.children([i]);

Examples

c = E(el).children();
c = E('myid').children();
el = E(el).children(0);

Return Value

Normally, the method returns an array or an element; but, if the index (i) is out of bounds, it will return undefined.

clone (E)

See Also

Feature Detection

Immediate

Syntax

el = e.clone([deep]);

Examples

el = E(el).clone();
el = E('myid').clone();
el = E(el).clone(true);

Return Value

The method returns an element.

containedBy (E)

Feature Detection

Deferred

Syntax

b = e.containedBy(el);

Examples

b = E(el).containedBy(elContainer);
b = E('myid').containedBy(elContainer);

Return Value

The method returns a boolean.

coverDocument (E)

Feature Detection

Deferred

Syntax

e.coverDocument();

Examples

E(el).coverDocument();
E('myid').coverDocument();

Return Value

The method returns the E object.

descendants (E)

Feature Detection

Immediate

Syntax

o = e.descendants([tag[, i]]);

Examples

els = E(el).descendants();
els = E('myid').descendants();
els = E(el).descendants('div');
el = E(el).descendants('div', 0);

Return Value

Normally, the method returns an array (or array-like host object) or an element; but, if the index (i) is out of bounds, it will return undefined.

Note array-like host objects are live collections, so handle with results with care. Use the toArray function to convert to an array.

detachDrag (E)

Feature Detection

Deferred

Syntax

e.detachDrag([elHandle]);

Examples

E(el).detachDrag();
E('myid').detachDrag();
E(el).detachDrag(elHandle);

Return Value

The method returns the E object.

dispatch (E)

Feature Detection

Deferred

Syntax

e.dispatch(ev[, evType]);

Examples

E(el).dispatch('click');
E('myid').dispatch('click');

Return Value

The method returns the E object.

document (E)

Feature Detection

Immediate

Syntax

doc = e.document();

Examples

doc = E(el).document();
doc = E('myid').document();

Return Value

dropIn (E)

Feature Detection

Deferred

Syntax

e.dropIn([options[, callback]]);

Examples

E(el).dropIn();
E('myid').dropIn();
E(el).dropIn({ ease:API.ease.circle, duration:1000 });
E(el).dropIn({ ease:API.ease.circle, duration:1000 }, fn);

Return Value

The method returns the E object.

dropOut (E)

Feature Detection

Deferred

Syntax

e.dropOut([options[, callback]])

Examples

E(el).dropOut();
E('myid').dropOut();
E(el).dropOut({ ease:API.ease.circle, duration:1000 });
E(el).dropOut({ ease:API.ease.circle, duration:1000 }, fn);

Return Value

The method returns the E object.

empty (E)

Feature Detection

Immediate

Syntax

e.empty();

Examples

E(el).empty();
E('myid').empty();

Return Value

The method returns the E object.

element (E)

Feature Detection

Immediate

Syntax

el = e.element();

Examples

el = E(el).element();
E('myid').element();

Return Value

The method returns an element.

fadeIn (E)

Feature Detection

Deferred

Syntax

e.fadeIn([options[, callback]]);

Examples

E(el).fadeIn();
E('myid').fadeIn();
E(el).fadeIn({ ease:API.ease.circle, duration:1000 });
E(el).fadeIn({ ease:API.ease.circle, duration:1000 }, fn);

Return Value

The method returns the E object.

fadeOut (E)

Feature Detection

Deferred

Syntax

e.fadeOut([options[, callback]]);

Examples

E(el).fadeOut();
E('myid').fadeOut();
E(el).fadeOut({ ease:API.ease.circle, duration:1000 });
E(el).fadeOut({ ease:API.ease.circle, duration:1000 }, fn);

Return Value

The method returns the E object.

foldIn (E)

Feature Detection

Deferred

Syntax

e.foldIn([options[, callback]]);

Examples

E(el).foldIn();
E('myid').foldIn();
E(el).foldIn({ ease:API.ease.circle, duration:1000 });
E(el).foldIn({ ease:API.ease.circle, duration:1000 }, fn);

Return Value

The method returns the E object.

foldOut (E)

Feature Detection

Deferred

Syntax

e.foldOut([options[, callback]]);

Examples

E(el).foldOut();
E('myid').foldOut();
E(el).foldOut({ ease:API.ease.circle, duration:1000 });
E(el).foldOut({ ease:API.ease.circle, duration:1000 }, fn);

Return Value

The method returns the E object.

fullScreen (E)

Feature Detection

Deferred

Syntax

e.fullScreen();

Examples

E(el).fullScreen();
E('myid').fullScreen();

Return Value

The method returns the E object.

getAttribute (E)

Feature Detection

Immediate

Syntax

s = e.getAttribute(name);

Examples

s = E(el).getAttribute('class');
s = E('myid').getAttribute('class');
s = E(el).getAttribute('style');

Return Value

The method returns a string or null.

getAttributeProperty (E)

Feature Detection

Immediate

Syntax

v = e.getAttributeProperty(name);

Examples

s = E(el).getAttributeProperty('class');
s = E('myid').getAttributeProperty('class');
b = E(el).getAttributeProperty('readonly');

Return Value

The method returns the property value or null.

getComputedStyle (E)

Feature Detection

Immediate

Syntax

s = e.getComputedStyle(style);

Examples

s = E(el).getComputedStyle('color');
s = E('myid').getComputedStyle('color');
s = E(el).getComputedStyle('backgroundColor');

Return Value

The method returns the a string or null.

Note that as with all style-related functions, the name of the style must be in camel-case.

getOpacity (E)

Feature Detection

Deferred

Note that this method will be made immediate in the near future.

Syntax

o = e.getOpacity();

Examples

o = E(el).getOpacity();
o = E('myid').getOpacity();

Return Value

The method returns a number from 0 to 1.

getPosition (E)

Feature Detection

Deferred

Syntax

p = e.getPosition();

Examples

p = E(el).getPosition();
p = E('myid').getPosition();

Return Value

The method returns an array.

getSize (E)

Feature Detection

Deferred

Syntax

d = e.getSize();

Examples

d = E(el).getSize();
d = E('myid').getSize();

Return Value

The method returns an array.

getStyle (E)

Feature Detection

Immediate

Syntax

s = e.getStyle(style);

Examples

s = E(el).getStyle('color');
s = E('myid').getStyle('color');
s = E(el).getStyle('backgroundColor');

Return Value

The method returns a string or null.

getText (E)

Feature Detection

Immediate

Syntax

s = e.getText();

Examples

s = E(el).getText();
s = E('myid').getText();

Return Value

The method returns a string.

growIn (E)

Feature Detection

Deferred

Syntax

e.growIn([options[, fnDone]]);

Examples

E(el).growIn();
E('myid').growIn();
E(el).growIn({ ease:API.ease.circle, duration:1000 });
E(el).growIn({ ease:API.ease.circle, duration:1000 }, fn);

Return Value

The method returns the E object.

growOut (E)

Feature Detection

Deferred

Syntax

e.growOut([options[, fnDone]]);

Examples

E(el).growOut();
E('myid').growOut();
E(el).growOut({ ease:API.ease.circle, duration:1000 });
E(el).growOut({ ease:API.ease.circle, duration:1000 }, fn);

Return Value

The method returns the E object.

hasAttribute (E)

Feature Detection

Immediate

Syntax

b = e.hasAttribute(name);

Examples

b = E(el).hasAttribute('class');
b = E('myid').hasAttribute('class');

Return Value

The method returns a boolean.

hasClass (E)

Feature Detection

Immediate

Syntax

b = e.hasClass(className);

Examples

b = E(el).hasClass('myclass');
b = E('myid').hasClass('myclass');

Return Value

The method returns a boolean.

html (E)

Feature Detection

Deferred

Syntax

s = e.html([xhtml]);

Examples

html = E(el).html();
html = E('myid').html();
xhtml = E(el).html(true);

Return Value

The method returns a string.

htmlOuter (E)

Feature Detection

Deferred

Syntax

s = e.htmlOuter([xhtml]);

Examples

html = E(el).htmlOuter();
html = E('myid').htmlOuter();
xhtml = E(el).htmlOuter(true);

Return Value

The method returns a string.

initiateDrag (E)

Feature Detection

Deferred

Syntax

e.initiateDrag();

Examples

E(el).initiateDrag();
E('myid').initiateDrag();

insertAfter (E)

Feature Detection

Immediate

Syntax

e.insertAfter(el);

Examples

E(elInsert).insertAfter(el);
E('myid').insertAfter(el);

Return Value

The method returns the E object.

insertBefore (E)

Feature Detection

Immediate

Syntax

e.insertBefore(el);

Examples

E(elInsert).insertBefore(el);
E('myid').insertBefore(el);

Return Value

The method returns the E object.

isAncestor (E)

Feature Detection

Immediate

Syntax

b = e.isAncestor(el);

Examples

b = E(elAncestor).isAncestor(el);
b = E('myid').isAncestor(el);

Return Value

The method returns a boolean.

isDescendant (E)

Feature Detection

Immediate

Syntax

b = e.isDescendant(el);

Examples

b = E('myid').isDescendant(elAncestor);
b = E(el).isDescendant(elAncestor);

Return Value

The method returns a boolean value

isPresent (E)

Feature Detection

Immediate

Syntax

b = e.isPresent();

Examples

b = E(el).isPresent();
b = E('myid').isPresent();

Return Value

The method returns a boolean.

isTag (E)

Feature Detection

Immediate

Syntax

b = e.isTag(tag);

Examples

b = E(el).isTag('div');

Return Value

The method returns a boolean.

isVisible (E)

Feature Detection

Immediate

Syntax

b = e.isVisible();

Examples

b = E(el).isVisible();
b = E('myid').isVisible();

Return Value

The method returns a boolean.

load (E)

Feature Detection

Immediate

Syntax

e.load(el);

Examples

E().load(el);
E().load('myid');

loadClone (E)

Feature Detection

Immediate

Syntax

e.loadClone(deep);

Examples

E(el).loadClone();

loadHtml (E)

Feature Detection

Immediate

Syntax

e.loadHtml(html[, docNode]);

Examples

E().loadHtml('<p>And then...</p>');

loadNew (E)

See Also

Feature Detection

Immediate

Syntax

e.loadNew(tag, attributesOrProperties, setProperties);

Examples

E().loadNew('div', { id:'you', 'class':'goodbye', disabled:'disabled' });

loadNext (E)

See Also

Feature Detection

Immediate

Syntax

e.loadNext();

Examples

E(el).loadNext();

loadPrevious (E)

See Also

Feature Detection

Immediate

Syntax

e.loadPrevious();

Examples

E(el).loadPrevious();

margin (E)

Feature Detection

Immediate

Syntax

i = e.margin(side);

Examples

i = E(el).margin('left');
i = E('myid').margin('left');
i = E(el).margin('top');

Return Value

The method returns a number of pixels.

margins (E)

Feature Detection

Immediate

Syntax

o = e.margins();

Examples

o = E(el).margins();
o = E('myid').margins();

Return Value

The method returns an object with properties named for each side (top, left, bottom and right), containing a number of pixels.

maximize (E)

Feature Detection

Deferred

Syntax

e.maximize([options[, callback]]);

Examples

E(el).maximize();
E('myid').maximize();

Return Value

The method returns the E object.

off (E)

Feature Detection

Immediate

Syntax

e.off(ev, fn);

Examples

E(el).off('click', function() { window.alert('Clicked'); });
E('myid').off('click', function() { window.alert('Also clicked'); });

Return Value

The method returns the E object.

offContextClick (E)

Feature Detection

Immediate

Syntax

e.offContextClick();

Examples

E(el).offContextClick();;
E('myid').offContextClick();;

Return Value

The method returns the E object.

offHelp (E)

Feature Detection

Immediate

Syntax

e.offHelp();

Examples

E(el).offHelp();
E('myid').offHelp();

Return Value

The method returns the E object.

on (E)

Feature Detection

Immediate

Syntax

e.on(ev, fn[, context]);

Examples

E(el).on('click', function() { window.alert('Clicked'); });
E('myid').on('click', function() { window.alert('Also clicked'); });
E(el).on('click', function() { this.log('Object clicked'); }, someObject);

Return Value

The method returns the E object.

onContextClick (E)

Feature Detection

Immediate

Syntax

E(id).onContextClick(fn[, context])

Examples

E(el).onContextClick(function() { window.alert('Context clicked'); });
E('myid').onContextClick(function() { window.alert('Also context clicked'); });
E(el).onContextClick(function() { this.log('Context clicked'); }, someObject);

Return Value

The method returns the E object.

onHelp (E)

Feature Detection

Immediate

Syntax

e.onHelp(fn[, context]);

Examples

E(el).onHelp(function() { window.alert('Help!'); });
E('myid').onHelp(function() { window.alert('Help yourself!'); });
E(el).onHelp(function(e) { this.showHelp(); }, someObject);

Return Value

The method returns the E object.

onRoll (E)

Feature Detection

Immediate

Syntax

e.onRoll(fnOver, fnOut[, context[, bAttachFocusListeners[, bSetStatus]]]);

Examples

E(el).onRoll(function() { window.status = 'over'; }, function() { window.status = 'and out'; } );
E('myid').onRoll(function() { window.status = 'roger'; }, function() { window.status = 'that'; } );
E(el).onRoll(function(e) { this.onover(e); }, function(e) { this.onout(e); }, someObject);

Return Value

The method returns the E object.

overlaps (E)

Feature Detection

Deferred

Syntax

b = e.overlaps(el);

Examples

b = E(elOverlay).overlaps(el);

Return Value

The method returns a boolean.

overlay (E)

Feature Detection

Deferred

Syntax

e.overlay(el[, cover])

Examples

E(elOverlay).overlay(el);
E('myid').overlay(el);
E(elOverlay).overlay(el, true);

Return Value

The method returns the E object.

position (E)

Feature Detection

Immediate

Syntax

e.position(y, x[, options[, callback]])

Examples

E(el).position(100, 100);
E('myid').position(0, 0);
E(el).position(100, 100, { duration:1000, ease:API.ease.circle });

Return Value

The method returns the E object.

positionStyle (E)

Feature Detection

Deferred

Syntax

p = e.positionStyle();

Examples

p = E(el).positionStyle();
p = E('myid').positionStyle();

Return Value

The method returns an array.

present (E)

Feature Detection

Deferred

Syntax

e.present(b[, display]);

Examples

E(el).present();
E(el).present(false);
E(el).present(true, 'block');
E(el).present(true, 'inline');

Return Value

The method returns the E object.

query (E)

Feature Detection

Immediate

Syntax

q = e.query(s);

Examples

q = E(el).query('div');
q = E('myid').query('div');
q = E(el).query('.myclass');

Return Value

The method returns a Q object.

relative (E)

Feature Detection

Deferred

Syntax

e.relative();

Examples

E(el).relative();
E('myid').relative();

Return Value

The method returns the E object.

remove (E)

Feature Detection

Immediate

Syntax

e.remove();

Examples

E(el).remove();
E('myid').remove();

Return Value

The method returns the E object.

removeAttribute (E)

Feature Detection

Immediate

Syntax

e.removeAttribute(name);

Examples

E(el).removeAttribute('class');
E('id').removeAttribute('class');
E(el).removeAttribute('style');

Return Value

The method returns the E object.

removeClass (E)

Feature Detection

Immediate

Syntax

e.removeClass(className);

Examples

E(el).removeClass('someclass');
E('myid').removeClass('someclass');
E(el).removeClass('someclass').removeClass('someotherclass');

Return Value

The method returns the E object.

replace (E)

Feature Detection

Immediate

Syntax

e.replace(el);

Examples

E(elReplacement).replace(el);
E('myid').replace(el);

Return Value

The method returns the E object.

restore (E)

Feature Detection

Deferred

Syntax

e.restore([options[, callback]]);

Examples

E(el).restore();
E('myid').restore();
E(el).restore({ duration:1000, ease:API.ease.circle });

Return Value

The method returns the E object.

setAttribute (E)

Feature Detection

Immediate

Syntax

e.setAttribute(name, value);

Examples

E(el).setAttribute('class', 'myclass');
E(el).setAttribute('checked', 'checked');
E(el).setAttribute('tabindex', '2');

Return Value

The method returns the E object.

setAttributeProperty (E)

Feature Detection

Immediate

Syntax

e.setAttributeProperty(name, value);

Examples

E(el).setAttributeProperty('class', 'myclass');
E(el).setAttributeProperty('checked', true);
E(el).setAttributeProperty('tabindex', 2);

Return Value

The method returns the E object.

setAttributes (E)

See Also

Feature Detection

Immediate

Syntax

e.setAttributes(attributes);

Examples

E(el).setAttributes({
  class: 'myclass',
  checked: 'checked',
  tabindex: '2'
});

Return Value

The method returns the E object.

setHtml (E)

Feature Detection

Immediate

Syntax

e.setHtml(html[, options[, callback]])

Examples

E(el).setHtml('<p>This is a test</p>');

Return Value

The method returns the E object.

setOpacity (E)

See Also

Feature Detection

Immediate

Syntax

e.setOpacity(o)

Examples

E(el).setOpacity(0.5);

Return Value

The method returns the E object.

setOuterHtml (E)

See Also

Feature Detection

Deferred

Syntax

e.setOuterHtml(html, options, fnDone)

Examples

E(el).setOuterHtml('<p>This is a test</p>');

Return Value

The method returns the E object.ss

setStyle (E)

See Also

Feature Detection

Immediate

Syntax

e.setStyle(style, value)

Examples

E(el).setStyle('color', '#ff0000');

Return Value

The method returns the E object.

setStyles (E)

See Also

Feature Detection

Immediate

Syntax

e.setStyles(styles)

Examples

E(el).setStyles({
  color: '#ff0000',
  backgroundColor: '#0000ff'
});

Return Value

The method returns the E object.

setText (E)

Feature Detection

Immediate

Syntax

e.setText(text);

Examples

E(el).setText('This is a test');
E('myid').setText('This is a test');

Return Value

The method returns the E object.

show (E)

Feature Detection

Deferred

Syntax

e.show(b[, options[, callback]]);

Examples

E(el).show();
E('myid').show();
E(el).show(false);

Return Value

The method returns the E object.

size (E)

Feature Detection

Deferred

Syntax

e.size(h, w[, options[, callback]);

Examples

E(el).size(100, 100);
E('myid').size(100, 100);

Return Value

The method returns the E object.

sizeOuter (E)

Feature Detection

Deferred

Syntax

e.sizeOuter(h, w);

Examples

E(el).sizeOuter(100, 100);
E('myid').sizeOuter(100, 100);

Return Value

The method returns the E object.

sizeStyle (E)

Feature Detection

Deferred

Syntax

d = e.sizeStyle();

Examples

d = E(el).sizeStyle();
d = E('myid').sizeStyle();

Return Value

The method returns an array.

springIn (E)

See Also

Feature Detection

Deferred

Syntax

e.springIn(elFrom[, options[, callback]]);

Examples

E(elPopup).springIn(el);
E('myid').springIn(el);

Return Value

The method returns the E object.

springOut (E)

See Also

Feature Detection

Deferred

Syntax

e.springOut(elFrom[, options[, callback]]);

Examples

E(elPopup).springOut(el);
E('myid').springOut(el);

Return Value

The method returns the E object.

toggle (E)

Feature Detection

Deferred

Syntax

e.toggle([options[, callback]]);

Examples

E(el).toggle();

Return Value

The method returns the E object.

togglePresence (E)

Feature Detection

Deferred

Syntax

e.togglePresence([display]);

Examples

E(el).togglePresence();
E(el).togglePresence('inline');
E(el).togglePresence('block');

Return Value

The method returns the E object.

update (E)

Feature Detection

Deferred

Syntax

e.update(uri, bAppend, updateOptions, fnUpdate, fnUpdated, requester)

Examples

E(el).update('http://www.cinsoft.net/');
E(el).update('http://www.cinsoft.net/', true);
E(el).update('http://www.cinsoft.net/', false, {
  effects: API.effects.fade,
  duration: 1000
});

Return Value

The method returns the E object.

F

See Also

The F function constructs an object that abstracts a form element. This constructor inherits from E.

Note to always use with the new operator if calling the constructor from an alternate frame. Creating F objects from forms in alternate frames does not require the new operator.

Syntax

f = F(id);
f = new F(id);

Examples

var s, f = F(0);
s = f.serialize();
f.send();

changed (F)

See Also

Feature Detection

Deferred

Syntax

b = f.changed();

Examples

b = F(0).changed();
b = F('myname').changed();

Return Value

The method returns a boolean.

controls (F)

Feature Detection

Deferred

Syntax

e = f.controls(i);

Examples

els = F(0).controls();
els = F('myname').controls();
el = F('myname').controls(0);

Return Value

The method returns an array or an element.

send (F)

See Also

Feature Detection

Immediate

Syntax

f.send([json[, requester]])

Examples

F(0).send();
F('nyname').send();
F(0).send(true);
F(0).send(true, requester);

Return Value

The method returns the F object.

serialize (F)

See Also

Feature Detection

Deferred

Syntax

s = f.serialize();

Examples

s = F(0).serialize();
s = F('myname').serialize();

Return Value

The method returns a string.

I

See Also

The I function constructs an object that abstracts an image element. This constructor inherits from E.

Note to always use with the new operator if calling the constructor from an alternate frame. Creating I objects from images in alternate frames does not require the new operator.

Syntax

i = I(id);
i = new I(id);

Examples

var i = I(0);
i.loadURI('testuri').slideIn({ duration:1000 }).on('click', function() { window.alert('Image clicked'); });

change (I)

See Also

Feature Detection

Deferred

Syntax

i.change(src[, options[, callback]])

Examples

I.change('http://www.cinsoft.net/images/cinsoft.gif');
I.change('http://www.cinsoft.net/images/cinsoft.gif', { effects: API.effects.fade, duration:1000, ease:API.ease.circle });
I.change('http://www.cinsoft.net/images/cinsoft.gif', { effects: [API.effects.fade, API.effects.grow], duration:1000, ease:API.ease.circle });

Return Value

The method returns the I object.

Q

The Q function constructs an object that abstracts multiple elements.

Note to always use with the new operator if calling the constructor from an alternate frame. Creating Q objects that query documents in alternate frames does not require the new operator.

Syntax

q = Q(selector[, node]);
q = new Q(selector[, node]);

Examples

var q = Q('div:last-child');
q.addClass('testclass').zoomIn({ duration:1000 }).on('click', function() { window.alert('Clicked'); });
q.load('div>div').addClass('testclass2').fadeIn({ duration:1000 }).on('click', function() { E(this).verticalBlindsOut({ duration:1000 }); });
q.load("#two.test1[test=test][test2]:first-child").slideIn({ duration:1000 }).on('click', function() { this.fadeOut({ duration:1000 }); }, q);
var q2 = Q([el1, el2, el3]);

addClass (Q)

See Also

Feature Detection

Immediate

Syntax

q.addClass(className);

Examples

Q('.myclass').addClass('yourclass');

Return Value

The method returns the Q object.

addHtml (Q)

See Also

Feature Detection

Deferred

Syntax

q.addHtml(html);

Examples

Q('.myclass').addHtml('<p></p>');

Return Value

The method returns the Q object.

addMe (Q)

Feature Detection

Immediate

Syntax

q.addMe([pos]);

Examples

Q('.myclass', el).addMe();
Q('.myclass', el).addMe(0);

Return Value

The method returns the Q object.

append (Q)

Feature Detection

Immediate

Syntax

q.append(selector[, node]);

Examples

Q('.myclass').append('.yourclass');

Return Value

The method returns the Q object.

appendTo (Q)

Feature Detection

Immediate

Syntax

q.appendTo(el);

Examples

Q('.myclass').appendTo(el);

Return Value

The method returns the Q object.

clear (Q)

Feature Detection

Immediate

Syntax

q.clear();

Examples

Q('.myclass').clear();

Return Value

The method returns the Q object.

copy (Q)

Feature Detection

Immediate

Syntax

r = q.copy();

Examples

r = Q('.myclass').copy()

Return Value

The method returns a new Q object.

dropIn (Q)

See Also

Feature Detection

Deferred

Syntax

q.dropIn([options[, callback]]);

Examples

Q('.myclass').dropIn();

Return Value

The method returns the Q object.

dropOut (Q)

See Also

Feature Detection

Deferred

Syntax

q.dropOut([options[, callback]]);

Examples

Q('.myclass').dropOut();

Return Value

The method returns the Q object.

empty (Q)

See Also

Feature Detection

Immediate

Syntax

q.empty();

Examples

Q('.myclass').empty();

Return Value

The method returns the Q object.

evens (Q)

See Also

Feature Detection

Immediate

Syntax

q.evens();

Examples

Q('.myclass').evens();

Return Value

The method returns the Q object.

every (Q)

See Also

Feature Detection

Immediate

Syntax

q.every(fn[, context]);

Examples

Q('.myclass').every(function(el) { return API.hasClass(el, 'yourclass'); });

Return Value

The method returns the Q object.

fadeIn (Q)

See Also

Feature Detection

Deferred

Syntax

q.fadeIn([options[, callback]]);

Examples

Q('.myclass').fadeIn();

Return Value

The method returns the Q object.

fadeOut (Q)

See Also

Feature Detection

Deferred

Syntax

q.fadeOut([options[, callback]]);

Examples

Q('.myclass').fadeOut();

Return Value

The method returns the Q object.

filter (Q)

See Also

Feature Detection

Immediate

Syntax

q.filter(fn[, context]);

Examples

Q('.myclass').filter(function() { return API.hasClass(el, 'yourclass'); });

Return Value

The method returns the Q object.

find (Q)

Feature Detection

Immediate

Syntax

r = q.find(selector);

Examples

r = Q('.myclass', el)
r = r.find('.yourclass');

Return Value

The method returns a new Q object.

first (Q)

See Also

Feature Detection

Immediate

Syntax

el = q.first();

Examples

el = Q('.myclass').first();

Return Value

The method returns an element.

foldIn (Q)

See Also

Feature Detection

Deferred

Syntax

q.foldIn([options[, callback]]);

Examples

Q('.myclass').foldIn();

Return Value

The method returns the Q object.

foldOut (Q)

See Also

Feature Detection

Deferred

Syntax

q.foldOut([options[, callback]]);

Examples

Q('.myclass').foldOut();

Return Value

The method returns the Q object.

forEach (Q)

See Also

Feature Detection

Immediate

Syntax

q.forEach(fn, context);

Examples

Q('.myclass').forEach(function() { API.addClass(el, 'yourclass'); });

Return Value

The method returns the Q object.

growIn (Q)

See Also

Feature Detection

Deferred

Syntax

q.growIn([options[, callback]]);

Examples

Q('.myclass').growIn();

Return Value

The method returns the Q object.

growOut (Q)

See Also

Feature Detection

Deferred

Syntax

q.growOut([options[, callback]]);

Examples

Q('.myclass').growOut();

Return Value

The method returns the Q object.

hasAttribute (Q)

See Also

Feature Detection

Immediate

Syntax

b = q.hasAttribute(name);

Examples

b = Q('.myclass').hasAttribute('style');

Return Value

The method returns a boolean.

hasClass (Q)

See Also

Feature Detection

Immediate

Syntax

b = q.hasClass(className);

Examples

b = Q('.myclass').hasClass('yourclass');

Return Value

The method returns a boolean.

indexOf (Q)

See Also

Feature Detection

Immediate

Syntax

i = q.indexOf(el);

Examples

i = Q('.myclass').indexOf(el);

Return Value

The method returns a number.

inject (Q)

See Also

Feature Detection

Immediate

Syntax

q.inject(pos[, selector[, node]]);

Examples


Return Value

The method returns the Q object.

insertAfter (Q)

See Also

Feature Detection

Immediate

Syntax

q.insertAfter(el);

Examples


	

Return Value

The method returns the Q object.

insertBefore (Q)

See Also

Feature Detection

Immediate

Syntax

q.insertBefore(el);

Examples


	

Return Value

The method returns the Q object.

last (Q)

See Also

Feature Detection

Immediate

Syntax

el = q.last();

Examples

el = Q('.myclass').last();

Return Value

The method returns an element or undefined if the query is empty.

loadHtml (Q)

See Also

Feature Detection

Immediate

Syntax

q.loadHtml(html[, docNode]);

Examples

Q().loadHtml('<p></p>');
Q().loadHtml('<p></p><div></div>');

Return Value

The method returns the Q object.

map (Q)

See Also

Feature Detection

Immediate

Syntax

a = q.map(fn[, context]);

Examples

a = Q('.myclass').map(function(el) { return el.id; });

Return Value

The method returns an array.

odds (Q)

See Also

Feature Detection

Immediate

Syntax

q.odds();

Examples

Q(.myclass').odds();

Return Value

The method returns the Q object.

off (Q)

See Also

Feature Detection

Immediate

Syntax

q.off(ev, fn);

Examples


	

Return Value

The method returns the Q object.

offContextClick (Q)

See Also

Feature Detection

Immediate

Syntax

q.offContextClick();

Examples

Q('.myclass').offContextClick();

Return Value

The method returns the Q object.

offHelp (Q)

See Also

Feature Detection

Immediate

Syntax

q.offHelp();

Examples

Q('.myclass').offHelp();

Return Value

The method returns the Q object.

offMousewheel (Q)

See Also

Feature Detection

Immediate

Syntax

q.offMousewheel();

Examples

Q('.myclass').offMousewheel();

Return Value

The method returns the Q object.

on (Q)

See Also

Feature Detection

Immediate

Syntax

q.on(ev, fn[, context]);

Examples

Q('.myclass').on('click', function() { window.alert('Clicked'); });

Return Value

The method returns the Q object.

onContextClick (Q)

See Also

Feature Detection

Immediate

Syntax

q.onContextClick(fn, context);

Examples


Return Value

The method returns the Q object.

onHelp (Q)

See Also

Feature Detection

Immediate

Syntax

q.onHelp(fn[, context]);

Examples

Q('.myclass').onHelp(function() { window.alert('Help!'); });

Return Value

The method returns the Q object.

onMousewheel (Q)

See Also

Feature Detection

Immediate

Syntax

q.onMousewheel(fn[, context]);

Examples

Q('.myclass').onMousewheel(function(e, delta) { window.status = delta; });

Return Value

The method returns the Q object.

onRoll (Q)

See Also

Feature Detection

Immediate

Syntax

q.onRoll(fnOver[, fnOut[, context[, attachFocusListeners[, setStatus]]]]);

Examples

Q('.myclass').onRoll(function() { window.alert('over'); }, function() { window.alert('out'); });

Return Value

The method returns the Q object.

pop (Q)

See Also

Feature Detection

Immediate

Syntax

el = q.pop();

Examples

el = Q('.myclass').pop();

Return Value

The method returns an element or undefined if the query is empty.

position (Q)

See Also

Feature Detection

Immediate

Syntax

q.position(top[, left])

Examples

Q('.myclass').position(100, 100);
Q('.yourclass').position(0, 0);

Return Value

The method returns the Q object.

prepend (Q)

See Also

Feature Detection

Immediate

Syntax

q.prepend(selector[, node]);

Examples

Q('p').prepend('div');
Q('.myclass').prepend('.yourclass');

Return Value

The method returns the Q object.

present (Q)

See Also

Feature Detection

Deferred

Syntax

q.present(b[, display]);

Examples

Q(.myclass').present();
Q(.yourclass').present(false);
Q(.myclass').present(true, 'block');
Q(.myclass').present(true, 'inline');

Return Value

The method returns the Q object.

push (Q)

See Also

Feature Detection

Immediate

Syntax

q.push(el1, [el2, ..., elN]);

Examples

Q('.myclass').push(el);
Q('.myclass').push(el1, el2);

Return Value

The method returns the Q object.

random (Q)

Feature Detection

Immediate

Syntax

el = q.random();

Examples

el = Q('.myclass').random();

Return Value

The method returns an element.

remove (Q)

Feature Detection

Immediate

Syntax

q.remove();

Examples

Q('.myclass').remove();

Return Value

The method returns the Q object.

removeAttribute (Q)

See Also

Feature Detection

Immediate

Syntax

q.removeAttribute(name);

Examples

Q('.myclass').removeAttribute('class');

Return Value

The method returns the Q object.

removeClass (Q)

See Also

Feature Detection

Immediate

Syntax

q.removeClass(className);

Examples

Q('.myclass').removeClass('myclass');

Return Value

The method returns the Q object.

reverse (Q)

See Also

Feature Detection

Immediate

Syntax

q.reverse();

Examples

Q('.myclass').reverse()

Return Value

The method returns the Q object.

setAttribute (Q)

See Also

Feature Detection

Immediate

Syntax

q.setAttribute(name, value);

Examples

Q('.myclass').setAttribute('disabled', 'disabled');
Q('.myclass').setAttribute('title', 'This control is disabled.');

Return Value

The method returns the Q object.

setAttributeProperty (Q)

See Also

Feature Detection

Immediate

Syntax

q.setAttributeProperty(name, value);

Examples

Q('.myclass').setAttributeProperty('disabled', true);
Q('.myclass').setAttributeProperty('title', 'This control is disabled.');

Return Value

The method the Q object.

setHtml (Q)

See Also

Feature Detection

Immediate

Syntax

q.setHtml(html);

Examples

Q('.myclass').setHtml('<p></p>');

Return Value

The method returns the Q object.

setOpacity (Q)

See Also

Feature Detection

Immediate

Syntax

q.setOpacity(o);

Examples

Q('.myclass').setOpacity(0.5);
Q('.yourclass').setOpacity(0.75);

Return Value

The method returns the Q object.

setStyle (Q)

See Also

Feature Detection

Immediate

Syntax

q.setStyle(style, value);

Examples

Q('.myclass').setStyle('backgroundColor', '#000');

Return Value

The method returns the Q object.

setStyles (Q)

See Also

Feature Detection

Immediate

Syntax

q.setStyles(styles);

Examples

Q('.myclass').setStyles({ color:'#F00', backgroundColor:'#000' });

Return Value

The method returns the Q object.

setText (Q)

See Also

Feature Detection

Immediate

Syntax

q.setText(text);

Examples

Q('.myclass').setText('This is a test.');

Return Value

The method returns the Q object.

shift (Q)

See Also

Feature Detection

Immediate

Syntax

el = q.shift();

Examples

el = Q('.myclass').shift();

Return Value

The method returns the Q object.

show (Q)

See Also

Feature Detection

Immediate

Syntax

q.show(b[, options[, callback]]);

Examples

Q('.myclass').show();
Q('.myclass').show({ effects:API.effects.fade, duration:1000, ease:API.ease.circle });

Return Value

The method returns the Q object.

size (Q)

See Also

Feature Detection

Immediate

Syntax

q.size(h, w[, options[, callback]]);

Examples

Q('.myclass').size(100, 100);
Q('.myclass').size(100, 100, { duration:1000, ease:API.ease.circle });

Return Value

The method returns the Q object.

sizeOuter (Q)

See Also

Feature Detection

Immediate

Syntax

q.sizeOuter(h, w);

Examples

Q('.myclass').sizeOuter(100, 100);

Return Value

The method returns the Q object.

slice (Q)

See Also

Feature Detection

Immediate

Syntax

q.slice(begin[, end]);

Examples

Q('.myclass').slice(1);
Q('.myclass').slice(0, 1);

Return Value

The method returns the Q object.

snip (Q)

See Also

Feature Detection

Immediate

Syntax

q.snip(pos, count);

Examples

Q('.myclass').snip(0, 1);

Return Value

The method returns the Q object.

some (Q)

See Also

Feature Detection

Immediate

Syntax

b = q.some(fn[, context]);

Examples

b = Q('.myclass').some(function(el) { return API.hasClass(el, 'yourclass'); });

Return Value

The method returns a boolean.

splice (Q)

See Also

Feature Detection

Immediate

Syntax

q.splice(index, howMany, [el1][el2, ..., elN]);

Examples

Q('.myclass').splice(1, 2);
Q('.myclass').splice(1, 2, el);

Return Value

The method returns the Q object.

toHtml (Q)

Feature Detection

Immediate

Syntax

s = q.toHtml([xhtml]);

Examples

html = q.toHtml();
xhtml = q.toHtml(true);

Return Value

The method returns a string.

toggle (Q)

See Also

Feature Detection

Deferred

Syntax

q.toggle([options[, callback]]);

Examples

Q('.myclass').toggle();
Q('.yourclass').toggle({ effects:API.effects.fade, duration:1000 });

Return Value

The method returns the Q object.

togglePresence (Q)

See Also

Feature Detection

Deferred

Syntax

q.togglePresence([display]);

Examples

Q('.myclass').togglePresence();
Q('.myclass').togglePresence('block');
Q('.yourclass').togglePresence('inline');

Return Value

The method returns the Q object.

unshift (Q)

See Also

Feature Detection

Immediate

Syntax

q.unshift(el1[, el2, ..., elN]);

Examples

Q('.myclass').unshift(el1, el2, el3, el4);

Return Value

The method returns the Q object.

W

The W function constructs an object that abstracts a window.

Note to always use with the new operator if calling the constructor from an alternate frame. Creating W objects from alternate frames does not require the new operator.

Syntax

w = W([window]);
w = new W([window]);

Examples

var w = W();
var s = w.getViewportSize();
w.setStatus('Viewport size ' + s);
w.addBookmark('http://www.cinsoft.net/mylib.html', 'My Library');

addBookmark (W)

See Also

Feature Detection

Immediate

Syntax

w.addBookmark(uri[, title]);

Examples

W().addBookmark('http://www.hartkelaw.net', 'Hartke Law Firm')
W(win).addBookmark('http://www.hartkelaw.net', 'Hartke Law Firm')

Return Value

The method returns the W object.

addBookmarkCurrent (W)

See Also

Feature Detection

Immediate

Syntax

w.addBookmarkCurrent();

Examples

W().addBookmarkCurrent()
W(win).addBookmarkCurrent()

Return Value

The method returns the W object.

getEnabledPlugin (W)

See Also

Feature Detection

Immediate

Syntax

p = w.getEnabledPlugin(mimeType[, title]);

Examples

p = W().getEnabledPlugin('audio/x-wav');
p = W(win).getEnabledPlugin('audio/x-wav');

Return Value

The function returns a string or null if an enabled plugin is not found.

getFrameById (W)

See Also

Feature Detection

Immediate

Syntax

frame = w.getFrameById(id);

Examples

frame = W().getFrameById('myid');
frame = W(win).getFrameById('myid');

Return Value

The method returns a window object or null if none is found.

getIFrameDocument (W)

See Also

Feature Detection

Immediate

Syntax

doc = w.getIFrameDocument(el);

Examples

doc = W().getIFrameDocument(el);
doc = W(win).getIFrameDocument(el);

Return Value

The method returns a document.

off (W)

See Also

Feature Detection

Immediate

Syntax

w.off(ev, fn);

Examples

W().off('resize', fn);
W(win).off('resize', fn);
W().off('scroll', fn);

Return Value

The method returns the W object.

on (W)

See Also

Feature Detection

Immediate

Syntax

w.on(ev, fn[, context]);

Examples

W().on('resize', function() { window.status = 'Resized'; });
W(win).on('resize', function() { window.status = 'Resized'; });
W().on('scroll', function(e) { this.onscroll(e); }, someObject);

Return Value

The method returns the W object.

setStatus (W)

See Also

Feature Detection

Immediate

Syntax

w.setStatus(text);

Examples

W().setStatus('Hello!');
W(win).setStatus('Hello to you!');

Return Value

The method returns the W object.

viewportSize (W)

See Also

Feature Detection

Deferred

Syntax

s = w.viewportSize();

Examples

s = W().viewportSize();
s = W(win).viewportSize();

Return Value

The method returns an array containing the height and width of the viewport in pixels.

Last Modified: 23 Apr 2010 22:29:00 GMT

By David Mark