Skip to content

Commit 810482b

Browse files
committed
Website updates
1 parent 47a5d62 commit 810482b

11 files changed

+19
-21
lines changed

dist/en/main/apidoc/module-ol_Collection-Collection.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2508,7 +2508,7 @@ <h4 class="name">
25082508

25092509
<div class="tag-source">
25102510
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/Collection.js">Collection.js</a>,
2511-
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/Collection.js#L243">line 243</a>
2511+
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/Collection.js#L240">line 240</a>
25122512
</div>
25132513

25142514
</div>
@@ -2643,7 +2643,7 @@ <h4 class="name">
26432643

26442644
<div class="tag-source">
26452645
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/Collection.js">Collection.js</a>,
2646-
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/Collection.js#L260">line 260</a>
2646+
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/Collection.js#L257">line 257</a>
26472647
</div>
26482648

26492649
</div>
@@ -2957,7 +2957,7 @@ <h4 class="name">
29572957

29582958
<div class="tag-source">
29592959
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/Collection.js">Collection.js</a>,
2960-
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/Collection.js#L281">line 281</a>
2960+
<a href="https://github.com/openlayers/openlayers/blob/main/src/ol/Collection.js#L278">line 278</a>
29612961
</div>
29622962

29632963
</div>

dist/en/main/examples/common.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/examples/common.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/examples/offscreen-canvas.worker.worker.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/examples/offscreen-canvas.worker.worker.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/ol/Collection.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ declare class Collection<T> extends BaseObject {
186186
/**
187187
* @private
188188
* @param {T} elem Element.
189-
* @param {number} [except] Optional index to ignore.
189+
* @param {number} [ignoreStartingAt] Optional indexes to ignore.
190190
*/
191191
private assertUnique_;
192192
}

dist/en/main/ol/Collection.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/ol/Collection.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ class Collection extends BaseObject {
108108
* @private
109109
* @type {!Array<T>}
110110
*/
111-
this.array_ = array ? array : [];
111+
this.array_ = array ?? [];
112112

113113
if (this.unique_) {
114-
for (let i = 0, ii = this.array_.length; i < ii; ++i) {
114+
for (let i = 1, ii = this.array_.length; i < ii; ++i) {
115115
this.assertUnique_(this.array_[i], i);
116116
}
117117
}
@@ -226,9 +226,6 @@ class Collection extends BaseObject {
226226
* @api
227227
*/
228228
push(elem) {
229-
if (this.unique_) {
230-
this.assertUnique_(elem);
231-
}
232229
const n = this.getLength();
233230
this.insertAt(n, elem);
234231
return this.getLength();
@@ -314,11 +311,12 @@ class Collection extends BaseObject {
314311
/**
315312
* @private
316313
* @param {T} elem Element.
317-
* @param {number} [except] Optional index to ignore.
314+
* @param {number} [ignoreStartingAt] Optional indexes to ignore.
318315
*/
319-
assertUnique_(elem, except) {
320-
for (let i = 0, ii = this.array_.length; i < ii; ++i) {
321-
if (this.array_[i] === elem && i !== except) {
316+
assertUnique_(elem, ignoreStartingAt) {
317+
const array = this.array_;
318+
for (let i = 0, ii = ignoreStartingAt ?? array.length; i < ii; ++i) {
319+
if (array[i] === elem) {
322320
throw new Error('Duplicate item added to a unique collection');
323321
}
324322
}

dist/en/main/ol/dist/ol.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/ol/dist/ol.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)