"The Permalink control passes an element as the first parameter, however, the
initialize.apply is called with the arguments object, which causes an error if an element is passed into the control." Also applied to Scale. Now fixed with review from e-dog. (Closes #978) Fixes the only problem I found with migrating the Boston freemap to 2.5. git-svn-id: http://svn.openlayers.org/trunk/openlayers@4333 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -31,9 +31,10 @@ OpenLayers.Control.Permalink = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
* Parameters:
|
* Parameters:
|
||||||
* element - {DOMElement}
|
* element - {DOMElement}
|
||||||
* base - {String}
|
* base - {String}
|
||||||
|
* options - {Object} options to the control.
|
||||||
*/
|
*/
|
||||||
initialize: function(element, base) {
|
initialize: function(element, base, options) {
|
||||||
OpenLayers.Control.prototype.initialize.apply(this, arguments);
|
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
||||||
this.element = OpenLayers.Util.getElement(element);
|
this.element = OpenLayers.Util.getElement(element);
|
||||||
this.base = base || document.location.href;
|
this.base = base || document.location.href;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -24,10 +24,10 @@ OpenLayers.Control.Scale = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* element - {DOMElement}
|
* element - {DOMElement}
|
||||||
* base - {String}
|
* options - {Object}
|
||||||
*/
|
*/
|
||||||
initialize: function(element) {
|
initialize: function(element, options) {
|
||||||
OpenLayers.Control.prototype.initialize.apply(this, arguments);
|
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
||||||
this.element = OpenLayers.Util.getElement(element);
|
this.element = OpenLayers.Util.getElement(element);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,12 @@
|
|||||||
map.events.triggerEvent("changelayer", {});
|
map.events.triggerEvent("changelayer", {});
|
||||||
t.ok(true, "permalink didn't bomb out.");
|
t.ok(true, "permalink didn't bomb out.");
|
||||||
}
|
}
|
||||||
|
function test_02_Control_Permalink_initwithelem (t) {
|
||||||
|
t.plan( 1 );
|
||||||
|
|
||||||
|
control = new OpenLayers.Control.Permalink(OpenLayers.Util.getElement('permalink'));
|
||||||
|
t.ok(true, "If the above line doesn't throw an error, we're safe.");
|
||||||
|
}
|
||||||
function test_02_Control_Permalink_updateLinks (t) {
|
function test_02_Control_Permalink_updateLinks (t) {
|
||||||
t.plan( 3 );
|
t.plan( 3 );
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,12 @@
|
|||||||
t.ok( control instanceof OpenLayers.Control.Scale, "new OpenLayers.Control returns object" );
|
t.ok( control instanceof OpenLayers.Control.Scale, "new OpenLayers.Control returns object" );
|
||||||
t.eq( control.displayClass, "olControlScale", "displayClass is correct" );
|
t.eq( control.displayClass, "olControlScale", "displayClass is correct" );
|
||||||
}
|
}
|
||||||
|
function test_02_Control_Scale_initwithelem (t) {
|
||||||
|
t.plan( 1 );
|
||||||
|
|
||||||
|
control = new OpenLayers.Control.Scale(OpenLayers.Util.getElement('scale'));
|
||||||
|
t.ok(true, "If this happens, then we passed. (FF throws an error above otherwise)");
|
||||||
|
}
|
||||||
function test_02_Control_Scale_updateScale (t) {
|
function test_02_Control_Scale_updateScale (t) {
|
||||||
t.plan( 4 );
|
t.plan( 4 );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user