Caching array length instead of accessing it with each iteration. r=crschmidt (closes #1636)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@7627 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -70,7 +70,7 @@ OpenLayers.Handler.Keyboard = OpenLayers.Class(OpenLayers.Handler, {
|
||||
*/
|
||||
activate: function() {
|
||||
if (OpenLayers.Handler.prototype.activate.apply(this, arguments)) {
|
||||
for (var i = 0; i < this.KEY_EVENTS.length; i++) {
|
||||
for (var i=0, len=this.KEY_EVENTS.length; i<len; i++) {
|
||||
OpenLayers.Event.observe(
|
||||
window, this.KEY_EVENTS[i], this.eventListener);
|
||||
}
|
||||
@@ -86,7 +86,7 @@ OpenLayers.Handler.Keyboard = OpenLayers.Class(OpenLayers.Handler, {
|
||||
deactivate: function() {
|
||||
var deactivated = false;
|
||||
if (OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
|
||||
for (var i = 0; i < this.KEY_EVENTS.length; i++) {
|
||||
for (var i=0, len=this.KEY_EVENTS.length; i<len; i++) {
|
||||
OpenLayers.Event.stopObserving(
|
||||
window, this.KEY_EVENTS[i], this.eventListener);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user