Merge pull request #21592 from Snuffleupagus/Iterator-helpers

Use Iterator methods to avoid some unnecessary Array creation
This commit is contained in:
Tim van der Meij 2026-07-19 13:46:58 +02:00 committed by GitHub
commit f12c6f64ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 3 deletions

View File

@ -447,7 +447,10 @@ class XFAObject {
[_getUnsetAttributes](protoAttributes) { [_getUnsetAttributes](protoAttributes) {
const allAttr = this[_attributeNames]; const allAttr = this[_attributeNames];
const setAttr = this[_setAttributes]; const setAttr = this[_setAttributes];
return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x)); return protoAttributes
.keys()
.filter(x => allAttr.has(x) && !setAttr.has(x))
.toArray();
} }
/** /**

View File

@ -366,8 +366,10 @@ class DrawLayer {
* Connected text layers sorted in document order. * Connected text layers sorted in document order.
*/ */
static #getOrderedTextLayers() { static #getOrderedTextLayers() {
return [...this.#textLayerSet] return this.#textLayerSet
.keys()
.filter(textLayer => textLayer.isConnected) .filter(textLayer => textLayer.isConnected)
.toArray()
.sort(compareTextLayers); .sort(compareTextLayers);
} }

View File

@ -113,7 +113,7 @@ class MathMLSanitizer {
"sanitizer", "sanitizer",
FeatureTest.isSanitizerSupported FeatureTest.isSanitizerSupported
? new Sanitizer({ ? new Sanitizer({
elements: [...MathMLElements].map(name => ({ elements: Array.from(MathMLElements.keys(), name => ({
name, name,
namespace: MathMLNamespace, namespace: MathMLNamespace,
})), })),