nsIDOMWindow
From MDC
The nsIDOMWindow interface is the primary interface for a DOM window object. It represents a single window object that may contain child windows if the document in the window contains an HTML frameset document, or if the document contains iframe elements.
While this interface is not officially defined by any standard bodies, it originates from the de-facto DOM Level 0 standard.
Starting in Firefox 3, DOM windows are actually based on nsIDOMWindow2, which is a subclass of nsIDOMWindow that adds some new features to this frozen interface.
Contents |
nsIDOMWindow is defined in dom/public/idl/base/nsIDOMWindow.idl. It is scriptable and
has been frozen since Mozilla 9.5.0.
Inherits from: nsISupports
[edit] Method overview
nsISelection getSelection();
|
void scrollBy(in long xScrollDif, in long yScrollDif);
|
void scrollTo(in long xScroll, in long yScroll);
|
void scrollByLines(in long numLines);
|
void scrollByPages(in long numPages);
|
void sizeToContent();
|
[edit] Attributes
| Attribute | Type | Description |
document
| nsIDOMDocument
| The document contained in the window. Read only. |
frames
| nsIDOMWindowCollection
| The child windows for this window. Cannot be accessed from scripts. Read only. |
name
| DOMString
| The window's name. This attribute is "replaceable" in JavaScript. |
parent
| nsIDOMWindow
| The window's parent window. If there is no parent window, or if the parent is of a different type, this is the current window. The window hierarchy does not cross chrome-content boundaries. Read only. |
scrollbars
| nsIDOMBarProp
| The object that controls whether or not scrollbars are shown in the window. This attribute is "replaceable" in JavaScript. Read only. |
scrollX
| long
| The current horizontal scroll position, in pixels. This attribute is "replaceable" in JavaScript. Read only. |
scrollY
| long
| The current vertical scroll position, in pixels. This attribute is "replaceable" in JavaScript. Read only. |
textZoom
| float
| The document scale factor as a multiplier of the default size. When setting this attribute, an NS_ERROR_NOT_IMPLEMENTED error may be returned by implementations not supporting zoom. This attribute should always return 1.0 for implementations not supporting text zoom. 1.0 represents normal (unzoomed) size. This attribute may not be accessed from scripts.
|
top
| nsIDOMWindow
| The root window for the hierarchy of windows that contain this nsIDOMWindow. This is the window itself if there is no parent, or if the parent is of a different type. The window hierarchy does not cross chrome-content boundaries. This attribute is "replaceable" in JavaScript. Read only.
|
[edit] Methods
[edit] getSelection()
Returns the nsISelection object indicating what if any content is currently selected in the window.
nsISelection getSelection();
[edit] Parameters
None.
[edit] Return value
The nsISelection object for the window.
[edit] scrollBy()
Scrolls the window by a given number of pixels.
void scrollBy( in long xScrollDif, in long yScrollDif );
[edit] Parameters
- xScrollDif
- The number of pixels by which to scroll horizontally.
- yScrollDif
- The number of pixels by which to scroll vertically.
[edit] scrollTo()
Scrolls the window to an absolute pixel offset.
void scrollTo( in long xScroll, in long yScroll );
[edit] Parameters
- xScroll
- The horizontal position to which to scroll, in pixels.
- yScroll
- The vertical position to which to scroll, in pixels.
[edit] scrollByLines()
Scrolls the window by the specified number of lines.
void scrollByLines( in long numLines );
[edit] Parameters
- numLines
- The number of lines by which to scroll.
[edit] scrollByPages()
Scrolls the window by the specified number of pages.
void scrollByPages( in long numPages );
[edit] Parameters
- numPages
- The number of pages by which to scroll.
[edit] sizeToContent()
Makes the window's size fit the contents of the window.
void sizeToContent();
[edit] Parameters
None.