Exit loop in onStackLayoutFocus earlier

The optimization removed in this patch is done twice. The effect is
that the loop does not end when it finds a match but the match happens
to be the current page.

This doesn't change anything. It's really only about performance.

Change-Id: I5c2de101eb2f14f814f00cf7eacf46b70346f4c8
This commit is contained in:
Thiemo Kreuz 2022-07-15 15:24:33 +02:00
parent 6baefa1190
commit 6e18ce647e

View file

@ -110,8 +110,7 @@ ve.ui.MWTwoPaneTransclusionDialogLayout.prototype.onStackLayoutFocus = function
// Find the page that an element was focused within // Find the page that an element was focused within
var $target = $( e.target ).closest( '.oo-ui-pageLayout' ); var $target = $( e.target ).closest( '.oo-ui-pageLayout' );
for ( var name in this.pages ) { for ( var name in this.pages ) {
// Check for page match, exclude current page to find only page changes if ( this.pages[ name ].$element[ 0 ] === $target[ 0 ] ) {
if ( this.pages[ name ].$element[ 0 ] === $target[ 0 ] && name !== this.currentPageName ) {
this.setPage( name ); this.setPage( name );
break; break;
} }