kis-js/src/polyfill.js

31 lines
548 B
JavaScript
Raw Normal View History

2011-11-02 12:10:58 -04:00
/**
* A module of various browser polyfills
* @file polyfill.js
*/
/**
* String trim function polyfill
*/
if(typeof String.prototype.trim === "undefined")
{
2011-11-02 12:10:58 -04:00
/**
* @private
2011-11-02 12:10:58 -04:00
*/
String.prototype.trim = function()
2011-11-03 16:04:35 -04:00
{
return this.replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, "");
};
}
// --------------------------------------------------------------------------
2012-03-29 11:58:32 -04:00
/**
* Array.isArray polyfill
*/
if (typeof Array.isArray === "undefined")
{
Array.isArray = function(v)
{
return Object.prototype.toString.apply(v) === '[object Array]';
}
}