From cfb7d195c0ec2ee82450f5a59b0c84ac8adca711 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sat, 5 Mar 2011 14:23:42 +0000 Subject: [PATCH] Use the new statics: true setting for Base injection, and fix Array.prototype.slice issue in Base.read(). --- src/paper.js | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/paper.js b/src/paper.js index 252b13cd..8a07fd33 100644 --- a/src/paper.js +++ b/src/paper.js @@ -13,27 +13,27 @@ this.install = function(scope) { //#include "../lib/bootstrap.js" Base.inject({ - statics: { - read: function(args, index, length) { - var index = index || 0, length = length || args.length - index; - if (length <= 1) { - var arg = args[index]; - // Return null when nothing was provided - if (arg instanceof this || arg == null) - return arg; - } - var obj = new this(this.dont); - obj = obj.initialize.apply(obj, index > 0 || length < args.length - ? slice.call(args, index, index + length) - : args) || obj; - return obj; - }, + statics: true, - capitalize: function(str) { - return str.replace(/\b[a-z]/g, function(match) { - return match.toUpperCase(); - }); + read: function(args, index, length) { + var index = index || 0, length = length || args.length - index; + if (length <= 1) { + var arg = args[index]; + // Return null when nothing was provided + if (arg instanceof this || arg == null) + return arg; } + var obj = new this(this.dont); + obj = obj.initialize.apply(obj, index > 0 || length < args.length + ? Array.prototype.slice.call(args, index, index + length) + : args) || obj; + return obj; + }, + + capitalize: function(str) { + return str.replace(/\b[a-z]/g, function(match) { + return match.toUpperCase(); + }); } });