mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-25 08:27:19 +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) {
|
||||
const allAttr = this[_attributeNames];
|
||||
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.
|
||||
*/
|
||||
static #getOrderedTextLayers() {
|
||||
return [...this.#textLayerSet]
|
||||
return this.#textLayerSet
|
||||
.keys()
|
||||
.filter(textLayer => textLayer.isConnected)
|
||||
.toArray()
|
||||
.sort(compareTextLayers);
|
||||
}
|
||||
|
||||
|
||||
@ -113,7 +113,7 @@ class MathMLSanitizer {
|
||||
"sanitizer",
|
||||
FeatureTest.isSanitizerSupported
|
||||
? new Sanitizer({
|
||||
elements: [...MathMLElements].map(name => ({
|
||||
elements: Array.from(MathMLElements.keys(), name => ({
|
||||
name,
|
||||
namespace: MathMLNamespace,
|
||||
})),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user