XPlatform

Class with static methods for supporting cross-platform

Remarks

Most browser-specific functionality is isolated and handled by static methods in this class.

Methods

getBorderBoxGets the sizes of the borders of an element.
getDocumentSizeGets the total width and height of the document.
getElementBoundsThe bounds of an element in document coordinates.
getElementSizeThe size of an element in document coordinates.
getEventTakes a low level Html event and converts it to a cross-platform event.
getMousePositionGets the current mouse position, in document coordinates.
getPaddingBoxGets the sizes of the padding of an element.
getViewportBoundsThe bounds of the currently visible portion of the document.
isMouseInsideReturns true if the mouse is inside the given element.

XPlatform getBorderBox static method

Gets the sizes of the borders of an element.

JavaScript

var borderObj = XPlatform.getBorderBox(element)

Returns

A JavaScript object with six properties, top, left, bottom, right, width and height.

XPlatform getDocumentSize static method

Gets the total width and height of the document.

JavaScript

var sizeObj = XPlatform.getDocumentSize()

Returns

A JavaScript object with two properties, width and height.

XPlatform getElementBounds static method

The bounds of an element in document coordinates.

JavaScript

var boundsObj = XPlatform.getElementBounds(elem)

Remarks

This returns an object with four properties, left, top, width, and height.

The left/top are the position of the top-left corner of the element, in pixels, using the document coordinate system (where 0, 0 is the top-left corner of the document).

The width/height are the width and height of the element, in pixels.

The sizes include paddings and borders.

Returns

A JavaScript object with four properties, left and top, width and height.

XPlatform getElementSize static method

The size of an element in document coordinates.

JavaScript

var boundsObj = XPlatform.getElementSize(elem)

Remarks

This returns an object with two properties, width, and height.

Returns

A JavaScript object with two properties, width and height.

XPlatform getEvent static method

Takes a low level Html event and converts it to a cross-platform event.

JavaScript

var xPlatformEvent = XPlatform.getEvent(evt)

Returns

This returns a XPlatformEvent instance, which wraps the low-level Html event and provides browser-safe methods for accessing important event properties.

XPlatform getMousePosition static method

Gets the current mouse position, in document coordinates.

JavaScript

var positionObj = XPlatform.getMousePosition()

Remarks

This returns the most current mouse position, in document coordinates, based on the last event processed by the framework.

Returns

A JavaScript object with two properties, left and top.

XPlatform getPaddingBox static method

Gets the sizes of the padding of an element.

JavaScript

var paddingObj = XPlatform.getPaddingBox(element)

Returns

A JavaScript object with six properties, top, left, bottom, right, width and height.

XPlatform getViewportBounds static method

The bounds of the currently visible portion of the document.

JavaScript

var boundsObj = XPlatform.getViewportBounds()

Remarks

This returns an object with four properties, left, top, width, and height.

The left/top are the position of the top-left corner of the visible region of the document, in pixels, where 0, 0 is the top-left corner of the document.

The width/height are the width and height of the window containing the document, in pixels .

Returns

A JavaScript object with four properties, left and top, width and height.

XPlatform isMouseInside static method

Returns true if the mouse is inside the given element.

JavaScript

XPlatform.isMouseInside(element)