Class: Window

Window

This is the class which simulates Window in HTML DOM.


new Window()

This Window object is created using by JSDOM, and attached the properties and the methods related to opening, closing, resizing and moving.

To open a new window, use Browser#newWindow or Browser#openWindow.

Properties:
Name Type Description
screen Screen

A Screen object.

innerWidth number

The inner width of this window about the window edge.

innerHeight number

The inner height of this window about the window edge.

scrollX number

The horizontal scroll position of the page in this window.

scrollY number

The vertical scroll position of the page in this window.

pageXOffset number

The horizontal scroll position of the page in this window.

pageYOffset number

The vertical scroll position of the page in this window.

screenX number

The horizontal window position.

screenY number

The vertical window position.

outerWidth number

The full width of this window.

outerHeight number

The full height of this window.

devicePixelRatio number

The zooming ratio of the page in this window.

closed boolean

The flag which is true if this window is closed.

name string

The window name.

Methods


close()

Closes this window.

Returns:
Type
Void

moveBy(dx, dy)

Moves this window by relative position from the current position of this window. This method is effective when this window is a popup.

Parameters:
Name Type Description
dx number

The horizontal moving size of this window.

dy number

The vertical moving size of this window.

Returns:
Type
Void

moveTo(x, y)

Moves this window position. This method is effective when this window is a popup.

Parameters:
Name Type Description
x number

The horizontal position of this window after moving.

y number

The vertical position of this window after moving.

Returns:
Type
Void

open(url, target, features)

Opens a window which is indicated by target or a new window.

In addition, loads the page content indicated by url if url is not empty.

Parameters:
Name Type Description
url string

An URL string of a page content.

target string

A window name or a keyword which is either _blank, _self, _parent or _top.

features string

A set of comma separated strings which specify position, size and styles of a new window.

Returns:

A window which is created or selected.

Type
Window

resizeBy(dw, dh)

Resizes this window size by relative size from the current size of this window. This method is effective when this window is a popup.

Parameters:
Name Type Description
dw number

The resizing width of this window.

dh number

The resizing height of this window.

Returns:
Type
Void

resizeTo(w, h)

Resizes this window size. This method is effective when this window is a popup.

Parameters:
Name Type Description
w number

The width of this window after resizing.

h number

The height of this window after resizing.

Returns:
Type
Void

scroll(x, y)

Scrolls the page in this window.

Parameters:
Name Type Description
x number

The horizontal scroll position after scrolling.

y number

The vertical scroll position after scrolling.

Returns:
Type
Void

scrollBy(dx, dy)

Scrolls the page in this window. The scroll size is relative position from the current scroll position.

Parameters:
Name Type Description
dx number

The horizontal scrolling size.

dy number

The vertical scrolling size.

Returns:
Type
Void

scrollTo(x, y)

Scrolls the page in this window.

Parameters:
Name Type Description
x number

The horizontal scroll position after scrolling.

y number

The vertical scroll position after scrolling.

Returns:
Type
Void