@@ -60,28 +60,6 @@ OpenLayers.String = {
|
|||||||
return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
|
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
|
* APIFunction: format
|
||||||
* Given a string with tokens in the form ${token}, return a string
|
* Given a string with tokens in the form ${token}, return a string
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ OpenLayers.Element = {
|
|||||||
|
|
||||||
var value = null;
|
var value = null;
|
||||||
if (element && element.style) {
|
if (element && element.style) {
|
||||||
value = element.style[OpenLayers.String.camelize(style)];
|
value = element.style[style];
|
||||||
if (!value) {
|
if (!value) {
|
||||||
if (document.defaultView &&
|
if (document.defaultView &&
|
||||||
document.defaultView.getComputedStyle) {
|
document.defaultView.getComputedStyle) {
|
||||||
@@ -171,7 +171,7 @@ OpenLayers.Element = {
|
|||||||
var css = document.defaultView.getComputedStyle(element, null);
|
var css = document.defaultView.getComputedStyle(element, null);
|
||||||
value = css ? css.getPropertyValue(style) : null;
|
value = css ? css.getPropertyValue(style) : null;
|
||||||
} else if (element.currentStyle) {
|
} else if (element.currentStyle) {
|
||||||
value = element.currentStyle[OpenLayers.String.camelize(style)];
|
value = element.currentStyle[style];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -493,14 +493,14 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
this.ovmap.zoomToMaxExtent();
|
this.ovmap.zoomToMaxExtent();
|
||||||
// check extent rectangle border width
|
// check extent rectangle border width
|
||||||
this.wComp = parseInt(OpenLayers.Element.getStyle(this.extentRectangle,
|
this.wComp = parseInt(OpenLayers.Element.getStyle(this.extentRectangle,
|
||||||
'border-left-width')) +
|
'borderLeftWidth')) +
|
||||||
parseInt(OpenLayers.Element.getStyle(this.extentRectangle,
|
parseInt(OpenLayers.Element.getStyle(this.extentRectangle,
|
||||||
'border-right-width'));
|
'borderRightWidth'));
|
||||||
this.wComp = (this.wComp) ? this.wComp : 2;
|
this.wComp = (this.wComp) ? this.wComp : 2;
|
||||||
this.hComp = parseInt(OpenLayers.Element.getStyle(this.extentRectangle,
|
this.hComp = parseInt(OpenLayers.Element.getStyle(this.extentRectangle,
|
||||||
'border-top-width')) +
|
'border-top-width')) +
|
||||||
parseInt(OpenLayers.Element.getStyle(this.extentRectangle,
|
parseInt(OpenLayers.Element.getStyle(this.extentRectangle,
|
||||||
'border-bottom-width'));
|
'borderBottomWidth'));
|
||||||
this.hComp = (this.hComp) ? this.hComp : 2;
|
this.hComp = (this.hComp) ? this.hComp : 2;
|
||||||
|
|
||||||
this.handlers.drag = new OpenLayers.Handler.Drag(
|
this.handlers.drag = new OpenLayers.Handler.Drag(
|
||||||
|
|||||||
@@ -221,13 +221,13 @@ OpenLayers.Handler.Box = OpenLayers.Class(OpenLayers.Handler, {
|
|||||||
document.body.removeChild(testDiv);
|
document.body.removeChild(testDiv);
|
||||||
|
|
||||||
var left = parseInt(OpenLayers.Element.getStyle(this.zoomBox,
|
var left = parseInt(OpenLayers.Element.getStyle(this.zoomBox,
|
||||||
"border-left-width"));
|
"borderLeftWidth"));
|
||||||
var right = parseInt(OpenLayers.Element.getStyle(
|
var right = parseInt(OpenLayers.Element.getStyle(
|
||||||
this.zoomBox, "border-right-width"));
|
this.zoomBox, "borderRightWidth"));
|
||||||
var top = parseInt(OpenLayers.Element.getStyle(this.zoomBox,
|
var top = parseInt(OpenLayers.Element.getStyle(this.zoomBox,
|
||||||
"border-top-width"));
|
"borderTopWidth"));
|
||||||
var bottom = parseInt(OpenLayers.Element.getStyle(
|
var bottom = parseInt(OpenLayers.Element.getStyle(
|
||||||
this.zoomBox, "border-bottom-width"));
|
this.zoomBox, "borderBottomWidth"));
|
||||||
this.boxOffsets = {
|
this.boxOffsets = {
|
||||||
left: left,
|
left: left,
|
||||||
right: right,
|
right: right,
|
||||||
|
|||||||
@@ -845,10 +845,10 @@ OpenLayers.Popup = OpenLayers.Class({
|
|||||||
|
|
||||||
//read the padding settings from css, put them in an OL.Bounds
|
//read the padding settings from css, put them in an OL.Bounds
|
||||||
contentDivPadding = new OpenLayers.Bounds(
|
contentDivPadding = new OpenLayers.Bounds(
|
||||||
OpenLayers.Element.getStyle(this.contentDiv, "padding-left"),
|
OpenLayers.Element.getStyle(this.contentDiv, "paddingLeft"),
|
||||||
OpenLayers.Element.getStyle(this.contentDiv, "padding-bottom"),
|
OpenLayers.Element.getStyle(this.contentDiv, "paddingBottom"),
|
||||||
OpenLayers.Element.getStyle(this.contentDiv, "padding-right"),
|
OpenLayers.Element.getStyle(this.contentDiv, "paddingRight"),
|
||||||
OpenLayers.Element.getStyle(this.contentDiv, "padding-top")
|
OpenLayers.Element.getStyle(this.contentDiv, "paddingTop")
|
||||||
);
|
);
|
||||||
|
|
||||||
//cache the value
|
//cache the value
|
||||||
|
|||||||
@@ -105,6 +105,30 @@ OpenLayers.Util.clearArray = function(array) {
|
|||||||
array.length = 0;
|
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<len; i++) {
|
||||||
|
var s = oStringList[i];
|
||||||
|
camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
|
||||||
|
}
|
||||||
|
return camelizedString;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function: setOpacity
|
* Function: setOpacity
|
||||||
* *Deprecated*. This function has been deprecated. Instead, please use
|
* *Deprecated*. This function has been deprecated. Instead, please use
|
||||||
|
|||||||
@@ -59,34 +59,7 @@
|
|||||||
str = " ";
|
str = " ";
|
||||||
t.eq(OpenLayers.String.trim(str), "", "whitespace string is trimmed correctly");
|
t.eq(OpenLayers.String.trim(str), "", "whitespace string is trimmed correctly");
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_String_camelize(t) {
|
|
||||||
t.plan(7);
|
|
||||||
|
|
||||||
var str = "chickenhead";
|
|
||||||
t.eq(OpenLayers.String.camelize(str), "chickenhead", "string with no hyphens is left alone");
|
|
||||||
|
|
||||||
str = "chicken-head";
|
|
||||||
t.eq(OpenLayers.String.camelize(str), "chickenHead", "string with one middle hyphen is camelized correctly");
|
|
||||||
|
|
||||||
str = "chicken-head-man";
|
|
||||||
t.eq(OpenLayers.String.camelize(str), "chickenHeadMan", "string with multiple middle hyphens is camelized correctly");
|
|
||||||
|
|
||||||
str = "-chickenhead";
|
|
||||||
t.eq(OpenLayers.String.camelize(str), "Chickenhead", "string with starting hyphen is camelized correctly (capitalized)");
|
|
||||||
|
|
||||||
str = "-chicken-head-man";
|
|
||||||
t.eq(OpenLayers.String.camelize(str), "ChickenHeadMan", "string with starting hypen and multiple middle hyphens is camelized correctly");
|
|
||||||
|
|
||||||
str = "chicken-";
|
|
||||||
t.eq(OpenLayers.String.camelize(str), "chicken", "string ending in hyphen is camelized correctly (hyphen dropped)");
|
|
||||||
|
|
||||||
str = "chicken-head-man-";
|
|
||||||
t.eq(OpenLayers.String.camelize(str), "chickenHeadMan", "string with multiple middle hyphens and end hyphen is camelized correctly (end hyphen dropped)");
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function test_String_format(t) {
|
function test_String_format(t) {
|
||||||
var unchanged = [
|
var unchanged = [
|
||||||
"", "${ ", "${", " ${", "${${", "${}", "${${}}", " ${ ${",
|
"", "${ ", "${", " ${", "${${", "${}", "${${}}", " ${ ${",
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
// Chromium 10: left is 0
|
// Chromium 10: left is 0
|
||||||
var testdiv = OpenLayers.Util.createDiv('testdiv', new OpenLayers.Pixel(5, 5));
|
var testdiv = OpenLayers.Util.createDiv('testdiv', new OpenLayers.Pixel(5, 5));
|
||||||
map.div.appendChild(testdiv);
|
map.div.appendChild(testdiv);
|
||||||
var left = parseInt(OpenLayers.Element.getStyle(testdiv, 'border-left-width'));
|
var left = parseInt(OpenLayers.Element.getStyle(testdiv, 'borderLeftWidth'));
|
||||||
map.div.removeChild(testdiv);
|
map.div.removeChild(testdiv);
|
||||||
var testAll = !isNaN(left);
|
var testAll = !isNaN(left);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script src="../../OLLoader.js"></script>
|
||||||
|
<script src="../../../lib/deprecated.js"></script>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
function test_String_camelize(t) {
|
||||||
|
t.plan(7);
|
||||||
|
|
||||||
|
var str = "chickenhead";
|
||||||
|
t.eq(OpenLayers.String.camelize(str), "chickenhead", "string with no hyphens is left alone");
|
||||||
|
|
||||||
|
str = "chicken-head";
|
||||||
|
t.eq(OpenLayers.String.camelize(str), "chickenHead", "string with one middle hyphen is camelized correctly");
|
||||||
|
|
||||||
|
str = "chicken-head-man";
|
||||||
|
t.eq(OpenLayers.String.camelize(str), "chickenHeadMan", "string with multiple middle hyphens is camelized correctly");
|
||||||
|
|
||||||
|
str = "-chickenhead";
|
||||||
|
t.eq(OpenLayers.String.camelize(str), "Chickenhead", "string with starting hyphen is camelized correctly (capitalized)");
|
||||||
|
|
||||||
|
str = "-chicken-head-man";
|
||||||
|
t.eq(OpenLayers.String.camelize(str), "ChickenHeadMan", "string with starting hypen and multiple middle hyphens is camelized correctly");
|
||||||
|
|
||||||
|
str = "chicken-";
|
||||||
|
t.eq(OpenLayers.String.camelize(str), "chicken", "string ending in hyphen is camelized correctly (hyphen dropped)");
|
||||||
|
|
||||||
|
str = "chicken-head-man-";
|
||||||
|
t.eq(OpenLayers.String.camelize(str), "chickenHeadMan", "string with multiple middle hyphens and end hyphen is camelized correctly (end hyphen dropped)");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script src="../../OLLoader.js"></script>
|
||||||
|
<script src="../../../lib/deprecated.js"></script>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
function test_String_camelize(t) {
|
||||||
|
t.plan(7);
|
||||||
|
|
||||||
|
var str = "chickenhead";
|
||||||
|
t.eq(OpenLayers.String.camelize(str), "chickenhead", "string with no hyphens is left alone");
|
||||||
|
|
||||||
|
str = "chicken-head";
|
||||||
|
t.eq(OpenLayers.String.camelize(str), "chickenHead", "string with one middle hyphen is camelized correctly");
|
||||||
|
|
||||||
|
str = "chicken-head-man";
|
||||||
|
t.eq(OpenLayers.String.camelize(str), "chickenHeadMan", "string with multiple middle hyphens is camelized correctly");
|
||||||
|
|
||||||
|
str = "-chickenhead";
|
||||||
|
t.eq(OpenLayers.String.camelize(str), "Chickenhead", "string with starting hyphen is camelized correctly (capitalized)");
|
||||||
|
|
||||||
|
str = "-chicken-head-man";
|
||||||
|
t.eq(OpenLayers.String.camelize(str), "ChickenHeadMan", "string with starting hypen and multiple middle hyphens is camelized correctly");
|
||||||
|
|
||||||
|
str = "chicken-";
|
||||||
|
t.eq(OpenLayers.String.camelize(str), "chicken", "string ending in hyphen is camelized correctly (hyphen dropped)");
|
||||||
|
|
||||||
|
str = "chicken-head-man-";
|
||||||
|
t.eq(OpenLayers.String.camelize(str), "chickenHeadMan", "string with multiple middle hyphens and end hyphen is camelized correctly (end hyphen dropped)");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
@@ -225,6 +225,7 @@
|
|||||||
<li>deprecated/Ajax.html</li>
|
<li>deprecated/Ajax.html</li>
|
||||||
<li>deprecated/BaseTypes/Class.html</li>
|
<li>deprecated/BaseTypes/Class.html</li>
|
||||||
<li>deprecated/BaseTypes/Element.html</li>
|
<li>deprecated/BaseTypes/Element.html</li>
|
||||||
|
<li>deprecated/BaseTypes/String.html</li>
|
||||||
<li>deprecated/Control/MouseToolbar.html</li>
|
<li>deprecated/Control/MouseToolbar.html</li>
|
||||||
<li>deprecated/Geometry/Rectangle.html</li>
|
<li>deprecated/Geometry/Rectangle.html</li>
|
||||||
<li>deprecated/Layer/GML.html</li>
|
<li>deprecated/Layer/GML.html</li>
|
||||||
|
|||||||
Reference in New Issue
Block a user