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.

$()

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())

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.

document([headContents], [bodyContents], [options], [callback])

Re-creates the iframe document, in the same way as a call to $.iframe(headContents, bodyContents, options, callback).

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.

style(cssText)

Appends a new <style> element to the iframe document’s head, using the cssText as the style contents.

jQuery manipulation methods

The following methods can be used in a similar way to the standard jQuery manipulation methods . All of them return the AOMI object.

Methods to manipulate the iframe element:

  • appendTo()
  • prependTo()
  • insertBefore()
  • insertAfter()
  • replaceAll()

Methods to manipulate the iframe document’s body:

  • append()
  • prepend()
  • html()
  • text()
  • wrapInner()
  • empty()

Clone this wiki locally