From 5875b50a510898093e3898f6bf43645b4815a8e9 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Mon, 21 Nov 2011 15:42:46 -0500 Subject: [PATCH] Moving camelize and its tests to deprecated --- lib/deprecated.js | 24 ++++++++++++++++ tests/deprecated/BaseTypes.html | 40 ++++++++++++++++++++++++++ tests/deprecated/BaseTypes/String.html | 40 ++++++++++++++++++++++++++ tests/list-tests.html | 1 + 4 files changed, 105 insertions(+) create mode 100644 tests/deprecated/BaseTypes.html create mode 100644 tests/deprecated/BaseTypes/String.html diff --git a/lib/deprecated.js b/lib/deprecated.js index 23f0d976b8..ebe9725b30 100644 --- a/lib/deprecated.js +++ b/lib/deprecated.js @@ -85,6 +85,30 @@ OpenLayers.Util.clearArray = function(array) { array.length = 0; }; + +/** + * APIFunction: camelize + * Camel-case a hyphenated string. + * Ex. "chicken-head" becomes "chickenHead", and + * "-chicken-head" becomes "ChickenHead". + * + * Parameters: + * str - {String} The string to be camelized. The original is not modified. + * + * Returns: + * {String} The string, camelized + */ + +OpenLayers.String.camelize = function(str) { + var oStringList = str.split('-'); + var camelizedString = oStringList[0]; + for (var i=1, len=oStringList.length; i + + + + + + + + + + diff --git a/tests/deprecated/BaseTypes/String.html b/tests/deprecated/BaseTypes/String.html new file mode 100644 index 0000000000..b8a66b8574 --- /dev/null +++ b/tests/deprecated/BaseTypes/String.html @@ -0,0 +1,40 @@ + + + + + + + + + + + diff --git a/tests/list-tests.html b/tests/list-tests.html index adc9580f73..af7b6b29d6 100644 --- a/tests/list-tests.html +++ b/tests/list-tests.html @@ -226,6 +226,7 @@
  • deprecated/Ajax.html
  • deprecated/BaseTypes/Class.html
  • deprecated/BaseTypes/Element.html
  • +
  • deprecated/BaseTypes/String.html
  • deprecated/Control/MouseToolbar.html
  • deprecated/Layer/MapServer/Untiled.html
  • deprecated/Layer/MultiMap.html