Adaptation of previous changes to the change from 61241e7 (null instead of undefined as the initial value)
This commit is contained in:
@@ -129,7 +129,7 @@ class Feature extends BaseObject {
|
||||
*/
|
||||
clone() {
|
||||
const clone = new Feature(
|
||||
this.hasProperties() ? this.getProperties() : undefined
|
||||
this.hasProperties() ? this.getProperties() : null
|
||||
);
|
||||
clone.setGeometryName(this.getGeometryName());
|
||||
const geometry = this.getGeometry();
|
||||
|
||||
@@ -95,7 +95,7 @@ class BaseObject extends Observable {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {!Object<string, *>}
|
||||
* @type {?Object<string, *>}
|
||||
*/
|
||||
this.values_ = null;
|
||||
|
||||
@@ -199,7 +199,7 @@ class BaseObject extends Observable {
|
||||
const oldValue = this.values_[key];
|
||||
delete this.values_[key];
|
||||
if (isEmpty(this.values_)) {
|
||||
delete this.values_;
|
||||
this.values_ = null;
|
||||
}
|
||||
if (!opt_silent) {
|
||||
this.notify(key, oldValue);
|
||||
|
||||
@@ -40,19 +40,19 @@ class Target extends Disposable {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Object<string, number>}
|
||||
* @type {?Object<string, number>}
|
||||
*/
|
||||
this.pendingRemovals_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Object<string, number>}
|
||||
* @type {?Object<string, number>}
|
||||
*/
|
||||
this.dispatching_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Object<string, Array<import("../events.js").Listener>>}
|
||||
* @type {?Object<string, Array<import("../events.js").Listener>>}
|
||||
*/
|
||||
this.listeners_ = null;
|
||||
}
|
||||
@@ -143,7 +143,7 @@ class Target extends Disposable {
|
||||
* @return {Array<import("../events.js").Listener>|undefined} Listeners.
|
||||
*/
|
||||
getListeners(type) {
|
||||
return this.listeners_ && this.listeners_[type];
|
||||
return (this.listeners_ && this.listeners_[type]) || undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,6 +33,11 @@ describe('ol.events.EventTarget', function () {
|
||||
});
|
||||
target.dispatchEvent('my-event');
|
||||
});
|
||||
it('does not initialize objects in advance', function () {
|
||||
expect(eventTarget.pendingRemovals_).to.be(null);
|
||||
expect(eventTarget.dispatching_).to.be(null);
|
||||
expect(eventTarget.listeners_).to.be(null);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#hasListener', function () {
|
||||
|
||||
Reference in New Issue
Block a user