Applied patch from ticket #3381 to Permalink tests and updated Permalink

control to pass tests by maintaining anchors.

All tests continue to pass.
This commit is contained in:
John Lien
2012-04-22 14:48:12 -04:00
parent 1691d4a71f
commit ab87c33670
2 changed files with 41 additions and 3 deletions

View File

@@ -172,11 +172,18 @@ OpenLayers.Control.Permalink = OpenLayers.Class(OpenLayers.Control, {
updateLink: function() {
var separator = this.anchor ? '#' : '?';
var href = this.base;
var anchor = null;
if (href.indexOf("#") != -1 && this.anchor == false) {
anchor = href.substring( href.indexOf("#"), href.length);
}
if (href.indexOf(separator) != -1) {
href = href.substring( 0, href.indexOf(separator) );
}
href += separator + OpenLayers.Util.getParameterString(this.createParams());
var splits = href.split("#");
href = splits[0] + separator+ OpenLayers.Util.getParameterString(this.createParams());
if (anchor) {
href += anchor;
}
if (this.anchor && !this.element) {
window.location.href = href;
}