Safari Developer Library

Developer

DOMWindow Additions Reference

Options
Deployment Target:

On This Page

DOMWindow

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Not Applicable Not Applicable

Availability


Available in Safari 4.0 and later.
Available in iOS 1.1.1 and later.

DOMWindow additions allow conversion of points between page- and node-coordinate systems for transitions, support for CSS media queries, and device orientation and motion events.

  • applicationCache Property

    The application cache associated with the current document.

    Declaration

    JavaScript

    readonly attribute DOMApplicationCache applicationCache

    Availability

    Available in Safari 4.0 and later.

    Available in iOS 2.2 and later.

  • Converts a point from page coordinates to node coordinates.

    Declaration

    JavaScript

    WebKitPoint webkitConvertPointFromPageToNode (in Node node, in WebKitPoint p);

    Parameters

    node

    The coordinate space to convert the given point to.

    p

    A point in page coordinates to convert to node coordinates.

    Return Value

    A point that is at the same location as p but in node coordinates.

    Availability

    Available in Safari 4.0 and later.

    Available in iOS 2.0 and later.

  • Converts a point from node coordinates to page coordinates.

    Declaration

    JavaScript

    WebKitPoint webkitConvertPointFromNodeToPage (in Node node, in WebKitPoint p);

    Parameters

    node

    The coordinate space for p.

    p

    A point in node coordinates to convert to page coordinates.

    Return Value

    A point that is at the same location as p but in page coordinates.

    Availability

    Available in Safari 4.0 and later.

    Available in iOS 2.0 and later.

  • styleMedia Property

    The style media object you use to make CSS media queries.

    Declaration

    JavaScript

    readonly attribute StyleMedia styleMedia

    Discussion

    Read StyleMedia Class Reference for details.

    Availability

    Available in Safari 5.0 and later.

    Available in iOS 4.2 and later.

  • orientation Property

    Specifies the orientation of the device.

    Declaration

    JavaScript

    readonly attribute long orientation

    Discussion

    This property is set to one of the values in Table 1. For example, if the user starts with the device in portrait orientation and then changes to landscape orientation by turning the device to the right, the window’s orientation property is set to -90. If the user instead changes to landscape by turning the device to the left, the window’s orientation property is set to 90. The default value is 0.

    Table 1Window orientation values

    Value

    Description

    0

    Portrait orientation. This is the default value.

    -90

    Landscape orientation with the screen turned clockwise.

    90

    Landscape orientation with the screen turned counterclockwise.

    180

    Portrait orientation with the screen turned upside down. This value is currently not supported on iPhone.

    Availability

    Available in iOS 1.1.1 and later.

  • ondevicemotion Property

    The event listener that is called when the device motion changes.

    Declaration

    JavaScript

    attribute EventListener ondevicemotion

    Discussion

    Read DeviceMotionEvent Class Reference for details.

    Availability

    Available in iOS 4.2 and later.

  • The event listener that is called while the device orientation changes around the x, y, and z axes.

    Declaration

    JavaScript

    attribute EventListener ondeviceorientation

    Discussion

    Read DeviceOrientationEvent Class Reference for details.

    Availability

    Available in iOS 4.2 and later.