|
@@ -25,6 +25,45 @@ if ( self.Int32Array === undefined ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
+// Shims for "startsWith", "endsWith", and "trim" for browsers where this is not yet implemented
|
|
|
+// not sure we should have this, or at least not have it here
|
|
|
+
|
|
|
+// http://stackoverflow.com/questions/646628/javascript-startswith
|
|
|
+// http://stackoverflow.com/questions/498970/how-do-i-trim-a-string-in-javascript
|
|
|
+// http://wiki.ecmascript.org/doku.php?id=harmony%3astring_extras
|
|
|
+
|
|
|
+if ( ! String.prototype.startsWith ) {
|
|
|
+
|
|
|
+ String.prototype.startsWith = function ( str ) {
|
|
|
+
|
|
|
+ return this.slice( 0, str.length ) === str;
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+if ( ! String.prototype.endsWith ) {
|
|
|
+
|
|
|
+ String.prototype.endsWith = function ( str ) {
|
|
|
+
|
|
|
+ var t = String( str );
|
|
|
+ var index = this.lastIndexOf( t );
|
|
|
+ return index >= 0 && index === this.length - t.length;
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+if ( ! String.prototype.trim ) {
|
|
|
+
|
|
|
+ String.prototype.trim = function () {
|
|
|
+
|
|
|
+ return this.replace( /^\s+|\s+$/g, "" );
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
|
|
|
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
|
|
|
|