From 7d58546162b88844609634700cdb85945f23eb22 Mon Sep 17 00:00:00 2001 From: euzuro Date: Tue, 24 Jul 2007 22:21:07 +0000 Subject: [PATCH] clean up unnecessarily complicated code in camelize() -- all tests pass ff & ie6 git-svn-id: http://svn.openlayers.org/trunk/openlayers@3806 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/BaseTypes.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/OpenLayers/BaseTypes.js b/lib/OpenLayers/BaseTypes.js index 8ee06a4656..bb154abe7b 100644 --- a/lib/OpenLayers/BaseTypes.js +++ b/lib/OpenLayers/BaseTypes.js @@ -97,19 +97,11 @@ String.indexOf = function(object) { */ String.prototype.camelize = function() { var oStringList = this.split('-'); - if (oStringList.length == 1) { - return oStringList[0]; - } - - var camelizedString = (this.indexOf('-') == 0) - ? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1) - : oStringList[0]; - - for (var i = 1, len = oStringList.length; i < len; i++) { + var camelizedString = oStringList[0]; + for (var i = 1; i < oStringList.length; i++) { var s = oStringList[i]; camelizedString += s.charAt(0).toUpperCase() + s.substring(1); } - return camelizedString; };