Merge pull request #64 from tmcw/no-camel

Removing camelize method.
This commit is contained in:
ahocevar
2012-02-28 00:05:58 -08:00
11 changed files with 119 additions and 63 deletions

View File

@@ -60,28 +60,6 @@ OpenLayers.String = {
return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
},
/**
* 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
*/
camelize: function(str) {
var oStringList = str.split('-');
var camelizedString = oStringList[0];
for (var i=1, len=oStringList.length; i<len; i++) {
var s = oStringList[i];
camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
}
return camelizedString;
},
/**
* APIFunction: format
* Given a string with tokens in the form ${token}, return a string

View File

@@ -163,7 +163,7 @@ OpenLayers.Element = {
var value = null;
if (element && element.style) {
value = element.style[OpenLayers.String.camelize(style)];
value = element.style[style];
if (!value) {
if (document.defaultView &&
document.defaultView.getComputedStyle) {
@@ -171,7 +171,7 @@ OpenLayers.Element = {
var css = document.defaultView.getComputedStyle(element, null);
value = css ? css.getPropertyValue(style) : null;
} else if (element.currentStyle) {
value = element.currentStyle[OpenLayers.String.camelize(style)];
value = element.currentStyle[style];
}
}

View File

@@ -493,14 +493,14 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
this.ovmap.zoomToMaxExtent();
// check extent rectangle border width
this.wComp = parseInt(OpenLayers.Element.getStyle(this.extentRectangle,
'border-left-width')) +
'borderLeftWidth')) +
parseInt(OpenLayers.Element.getStyle(this.extentRectangle,
'border-right-width'));
'borderRightWidth'));
this.wComp = (this.wComp) ? this.wComp : 2;
this.hComp = parseInt(OpenLayers.Element.getStyle(this.extentRectangle,
'border-top-width')) +
parseInt(OpenLayers.Element.getStyle(this.extentRectangle,
'border-bottom-width'));
'borderBottomWidth'));
this.hComp = (this.hComp) ? this.hComp : 2;
this.handlers.drag = new OpenLayers.Handler.Drag(

View File

@@ -221,13 +221,13 @@ OpenLayers.Handler.Box = OpenLayers.Class(OpenLayers.Handler, {
document.body.removeChild(testDiv);
var left = parseInt(OpenLayers.Element.getStyle(this.zoomBox,
"border-left-width"));
"borderLeftWidth"));
var right = parseInt(OpenLayers.Element.getStyle(
this.zoomBox, "border-right-width"));
this.zoomBox, "borderRightWidth"));
var top = parseInt(OpenLayers.Element.getStyle(this.zoomBox,
"border-top-width"));
"borderTopWidth"));
var bottom = parseInt(OpenLayers.Element.getStyle(
this.zoomBox, "border-bottom-width"));
this.zoomBox, "borderBottomWidth"));
this.boxOffsets = {
left: left,
right: right,

View File

@@ -845,10 +845,10 @@ OpenLayers.Popup = OpenLayers.Class({
//read the padding settings from css, put them in an OL.Bounds
contentDivPadding = new OpenLayers.Bounds(
OpenLayers.Element.getStyle(this.contentDiv, "padding-left"),
OpenLayers.Element.getStyle(this.contentDiv, "padding-bottom"),
OpenLayers.Element.getStyle(this.contentDiv, "padding-right"),
OpenLayers.Element.getStyle(this.contentDiv, "padding-top")
OpenLayers.Element.getStyle(this.contentDiv, "paddingLeft"),
OpenLayers.Element.getStyle(this.contentDiv, "paddingBottom"),
OpenLayers.Element.getStyle(this.contentDiv, "paddingRight"),
OpenLayers.Element.getStyle(this.contentDiv, "paddingTop")
);
//cache the value