Utilities

Below are the utility methods eCSStender exposes via its API.

getPathTo( resource, tag )

Returns: String

Attempts to return the folder path to a given resource (a filename). By default, the method assumes a tag value of “script,” but “link” and “img” are also acceptable. If no match is found, the method returns NULL.

isInheritedProperty( object, property )

Returns: Boolean

Determines whether or not a given property belongs to an object or whether it was inherited from its parent object. This method is most frequently used within for...in loops to avoid issues caused by a developer or library’s augmentation of Object (e.g. the Prototype JavaScript library).

loadScript( path, callback )

Returns: NULL

To dynamically add a script to your page, you can call eCSStender.loadScript(), passing the path to the script as the first argument. If you’d like to add a callback function (to be run once the file is loaded), it can be supplied as the optional second argument.

trim( string )

Returns: String

Trims leading and trailing whitespace from a string and returns it.