mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 22:35:41 +00:00
ve.init.mw.DesktopArticleTarget: Fix the code to reorder tabs
This code is meant to fix up the tabs if wgVisualEditorTabPosition
was changed and we're seeing cached HTML with the tabs in wrong order.
But it seems it has never worked. `$caEdit[ 0 ].nextSibling` is a text
node and obviously not equal to `$caVeEdit[ 0 ]`, and vice versa for
the other case. The logic is actually correct, so let's fix it to skip
over text nodes.
Also, remove a stray 'eslint-enable' comment left over in
a0f934ed26
.
Bug: T50017
Change-Id: I23663a9bfcfdbf52918452c878a128e6960b1191
This commit is contained in:
parent
a0f934ed26
commit
81d567bfdc
|
@ -467,15 +467,14 @@
|
|||
} else if ( $caEdit.length && $caVeEdit.length ) {
|
||||
// Make the state of the page consistent with the config if needed
|
||||
if ( conf.tabPosition === 'before' ) {
|
||||
if ( $caEdit[ 0 ].nextSibling === $caVeEdit[ 0 ] ) {
|
||||
if ( $caEdit.next()[ 0 ] === $caVeEdit[ 0 ] ) {
|
||||
$caVeEdit.after( $caEdit );
|
||||
}
|
||||
} else {
|
||||
if ( $caVeEdit[ 0 ].nextSibling === $caEdit[ 0 ] ) {
|
||||
if ( $caVeEdit.next()[ 0 ] === $caEdit[ 0 ] ) {
|
||||
$caEdit.after( $caVeEdit );
|
||||
}
|
||||
}
|
||||
// eslint-enable no-bitwise
|
||||
if ( tabMessages[ action ] !== null ) {
|
||||
$caVeEditLink.text( mw.msg( tabMessages[ action ] ) );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue