Ticket #788 (closed bug: fixed)

Opened 6 years ago

Last modified 6 years ago

Control displayClass is not correct if CLASS_NAME contains >= 2 periods

Reported by: fredj Owned by:
Priority: minor Milestone: 2.5 Release
Component: Control Version: SVN
Keywords: Cc:
State:

Description

From Glen Stampoultzis (to the dev mailing list):

In Control.js:

    /**
     * @constructor
     *
     * @param {Object} options
     */
    initialize: function (options) {
        // We do this before the extend so that instances can override
        // className in options.
        this.displayClass = this.CLASS_NAME.replace("OpenLayers.", "ol").replace(".","");

        OpenLayers.Util.extend(this, options);

        this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
    },


the replace only replaces the first period. Better would be something like this:

this.displayClass = this.CLASS_NAME.replace("OpenLayers.", "ol").replace(/\./g, "");

Attachments

Control.displayClass.diff Download (0.6 KB) - added by fredj 6 years ago.
remove all the periods
Control.displayClass.tests.diff Download (7.5 KB) - added by fredj 6 years ago.
test if control.displayClass is correct (in tests/Control/test_*)

Change History

Changed 6 years ago by fredj

remove all the periods

Changed 6 years ago by fredj

test if control.displayClass is correct (in tests/Control/test_*)

Changed 6 years ago by fredj

  • type changed from feature to bug
  • summary changed from Control displayClass to Control displayClass is not correct if CLASS_NAME contains > 2 periods

Changed 6 years ago by fredj

  • summary changed from Control displayClass is not correct if CLASS_NAME contains > 2 periods to Control displayClass is not correct if CLASS_NAME contains >= 2 periods

Changed 6 years ago by crschmidt

  • status changed from new to closed
  • resolution set to fixed

Applied in r3534.

Note: See TracTickets for help on using tickets.