I’ve run into an issue with OL 2.4 (branch HEAD) and Microsoft Ajax.Net.
In BaseTypes.js, the following function:
String.prototype.trim = function() {
var b = 0;
while(this.substr(b,1) == " ") {
b++;
}
var e = this.length - 1;
while(this.substr(e,1) == " ") {
e--;
}
return this.substring(b, e+1);
};
Is failing because e is going negative and goes into an endless loop. The
string being fed (from an Ajax.Net call) is simply two spaces (“ “).
It appears that Ajax.Net is also prototyping a trim function onto String,
and commenting out the one in BaseTypes.js gets everything working again.
How do you detect that a function has already been prototyped on to a class
so OL doesn’t have to do it?
Here is a test_String.html that confirms the issue.
<html>
<head>
<script src="../../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
function test_01_Trim (t) {
t.plan( 1 );
var s;
s = " test ".trim();
size = new OpenLayers.Size(5,6);
//t.ok( size instanceof OpenLayers.Size, "new OpenLayers.Size
returns size object" );
t.eq( s, "test", "string.trim worked correctly");
}
function test_01a_Trim (t) {
t.plan( 1 );
var s;
s = " ".trim();
size = new OpenLayers.Size(5,6);
t.eq( s, "", "string.trim worked correctly");
}
// -->
</script>
</head>
<body>
</body>
</html>
Thanks,
John
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.485 / Virus Database: 269.13.13/998 - Release Date: 9/10/2007
8:48 AM
This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed. If
you have received this email in error please notify the sender. This message
contains confidential information and is intended only for the individual
named. If you are not the named addressee you should not disseminate,
distribute or copy this e-mail.
_______________________________________________
Dev mailing list
[email protected]
http://openlayers.org/mailman/listinfo/dev