mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-27 09:27:20 +02:00
Merge pull request #21592 from Snuffleupagus/Iterator-helpers
Use Iterator methods to avoid some unnecessary Array creation
This commit is contained in:
commit
f12c6f64ad
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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,
|
||||||
})),
|
})),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user