Class tsCompatibility
Giovanni Capalbo <gcapalbo@users.sourceforge.net>
This source file is subject to the LGPL license, which is available online at this address: http://www.gnu.org/copyleft/lesser.html
This class is intended to abstract specific browser functionality into one class so that there is just one interface to the functionality contained herein. All attributes and methods in this class are static so that they can be referenced globally without instantiating new objects.
Attribute Summary
Name | Description |
fixedPositioning | True if the current browser supports CSS fixed positioning, false if not. |
IE | True if the current browser is any version of Internet Explorer, false if not. |
Method Summary
Attribute Details
fixedPositioning
NOTE: This attribute is static, so it is referenced as tsCompatibility.fixedPositioning
boolean
True if the current browser supports CSS fixed positioning, false if not.
public
IE
NOTE: This attribute is static, so it is referenced as tsCompatibility.IE
boolean
True if the current browser is any version of Internet Explorer, false if not.
public
Method Details
absoluteX
NOTE: This method is static, so it is referenced as tsCompatibility.absoluteX
Retrieves the x-coordinate of the given HTMLElement in relation to the upper-left corner of the browser's client area.
Type | Name | Description |
HTMLElement | node | The HTMLElement. |
number; The x-coordinate.
public
absoluteY
NOTE: This method is static, so it is referenced as tsCompatibility.absoluteY
Retrieves the y-coordinate of the given HTMLElement in relation to the upper-left corner of the browser's client area.
Type | Name | Description |
HTMLElement | node | The HTMLElement. |
number; The y-coordinate.
public
addEventListener
NOTE: This method is static, so it is referenced as tsCompatibility.addEventListener
Adds an event listener to an HTMLElement.
Type | Name | Description |
mixed | obj | The object to add the event listener to, can be an HTMLElement or the window object. |
string | type | The type of event to add ('click', 'mouseover', etc.). |
function | fcn | The function to execute when the event happens. |
boolean | phase | true to detect the event in the capturing phase, false for bubbling phase. |
void
public
clientHeight
NOTE: This method is static, so it is referenced as tsCompatibility.clientHeight
Retrieves the height of the given object's client area.
Type | Name | Description |
mixed | obj | The object whose client height to retrieve. Can be an HTMLElement or the window object. |
number; The height of the client area.
public
clientWidth
NOTE: This method is static, so it is referenced as tsCompatibility.clientWidth
Retrieves the width of the given object's client area.
Type | Name | Description |
mixed | obj | The object whose client width to retrieve. Can be an HTMLElement or the window object. |
number; The width of the client area.
public
createXMLHttpRequest
NOTE: This method is static, so it is referenced as tsCompatibility.createXMLHttpRequest
Creates an XMLHttpRequest object.
(none)
XMLHttpRequest; The XMLHttpRequest object, or null on error.
public
eventTarget
NOTE: This method is static, so it is referenced as tsCompatibility.eventTarget
Retrieves the HTMLElement that is being acted upon by a specific event.
Type | Name | Description |
Event | e | The event that was fired. |
HTMLElement; The element that the event was fired upon.
public
fireClickEvent
NOTE: This method is static, so it is referenced as tsCompatibility.fireClickEvent
Fires a click event on the given HTMLElement.
Type | Name | Description |
HTMLElement | obj | The element to fire upon. |
void
public
fireKeyEvent
NOTE: This method is static, so it is referenced as tsCompatibility.fireKeyEvent
Fires a keydown and keyup event on the given HTMLElement.
Type | Name | Description |
HTMLElement | obj | The object to fire upon. |
mixed | charToPress | The character to press (either the numerical code or string representation is ok, e.g., 0x41 or "A"). |
void
public
numericalValue
NOTE: This method is static, so it is referenced as tsCompatibility.numericalValue
Strips the 'px' off of a string and returns its value as a number. This function should be used for retrieving height, width, etc. style parameters as integers only in the rare events that the offsetHeight/offsetWidth,etc. attributes do not work.
Type | Name | Description |
string | value | The style value whose numerical value to retreive. |
number; The value.
public
removeEventListener
NOTE: This method is static, so it is referenced as tsCompatibility.removeEventListener
Removes an event listener from an HTMLElement.
Type | Name | Description |
HTMLElement | obj | The element to remove the event listener from. |
string | type | The type of event to remove ('click', 'mouseover', etc.). |
function | fcn | The function associated with the event. |
boolean | phase | true if the event was detected in the capturing phase, false for bubbling phase. |
void
public