Skip to content
premasagar edited this page Sep 13, 2010 · 14 revisions

Except where otherwise stated, all methods return the AOMI object itself, to allow method chaining.

body()

Returns the body element of the iframe’s document, wrapped in a jQuery object.

If the body element cannot be accessed (e.g. because the iframe is not in the DOM, or the iframe is displaying a document from a different domain), then an an empty jQuery collection, with zero length, is returned.

body(contents, [emptyFirst])

  • contents will be appended to the iframe’s body element. May be an HTML string, DOM node, jQuery collection, or selector.
  • emptyFirst is an optional boolean (default false). If true, the body element will first be emptied of all child nodes.

head()

Returns the head element of the iframe’s document, wrapped in a jQuery object.

If the head element cannot be accessed (e.g. because the iframe is not in the DOM, or the iframe is displaying a document from a different domain), then an an empty jQuery collection, with zero length, is returned.

head(contents, [emptyFirst])

  • contents will be appended to the iframe’s head element. May be an HTML string, DOM node, jQuery collection, or selector.
  • emptyFirst is an optional boolean (default false). If true, the head element will first be emptied of all child nodes.

window()

Returns the iframe’s window object, wrapped in a jQuery object.

If the window object cannot be accessed (e.g. because the iframe is not in the DOM, or the iframe is displaying a document from a different domain), then an an empty jQuery collection, with zero length, is returned.

document()

Returns the iframe’s document object, wrapped in a jQuery object.

If the document object cannot be accessed (e.g. because the iframe is not in the DOM, or the iframe is displaying a document from a different domain), then an an empty jQuery collection, with zero length, is returned.

$()

A shortcut for document(). This is analagous to the jQuery method $.(), which returns the global document object.

$(selector)

Returns a set of elements from the iframe’s document body, matching the CSS selector.
This identical to: jQuery(selector, aomi.body())

doctype()

Returns the iframe document’s doctype string, e.g. <!DOCTYPE html>.

doctype(htmlVersion)

Sets the AOMI object’s doctype option to the new HTML version, e.g. aomi.doctype(5); for HTML5. The doctype is used when the iframe document is created.

location()

Returns the iframe window’s location, if it can be determined (this will happen if the iframe is in the DOM and it has a document from the same domain as the host document). If not, then the method will either return the iframe element’s src attribute (if the iframe is out of the DOM and has a document from the same domain as the host document), or otherwise null.

contents([headContents], bodyContents, [emptyFirst])

Appends contents to the iframe document’s head and body.
Shortcut for aomi.head(headContents, emptyFirst).body(bodyContents, emptyFirst).

title()

style()

resize()

Clone this wiki locally