From 31e1f20570c9a4698a668e82c126d9fc24158124 Mon Sep 17 00:00:00 2001 From: thiemowmde Date: Wed, 21 Feb 2024 12:55:50 +0100 Subject: [PATCH] Gallery: Avoid expensive .getAttributes() call in MWGalleryImageNode This actually creates an (expensive) clone of all attributes. Even if this particular code is only interested in a single one of them. I checked and it's purely used for reading, not writing. So it doesn't make a difference if it's a clone or not. Change-Id: I428e684ea2fa20ffcfcc53b618f3fc032d930c75 --- modules/ve-mw/ce/nodes/ve.ce.MWGalleryImageNode.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWGalleryImageNode.js b/modules/ve-mw/ce/nodes/ve.ce.MWGalleryImageNode.js index f865a4daa3..c2547323cd 100644 --- a/modules/ve-mw/ce/nodes/ve.ce.MWGalleryImageNode.js +++ b/modules/ve-mw/ce/nodes/ve.ce.MWGalleryImageNode.js @@ -30,7 +30,7 @@ ve.ce.MWGalleryImageNode = function VeCeMWGalleryImageNode( model ) { var defaults = mw.config.get( 'wgVisualEditorConfig' ).galleryOptions; var attributes = model.getAttributes(); - var galleryMwAttrs = model.parent.getAttributes().mw.attrs; + var galleryMwAttrs = model.parent.getAttribute( 'mw' ).attrs; // Putting all this setup in the constructor works because MWGalleryImageNodes are never updated, // only created from scratch