jenkins-bot has submitted this change and it was merged.

Change subject: IndentationCommand: Use hasMatchingAncestor
......................................................................


IndentationCommand: Use hasMatchingAncestor

This also correctly requires all selected nodes to be in lists,
instead of just one of them.

Bug: T147858
Change-Id: I776f5a777189695a7fdcbe32323b34b732765fa5
---
M src/ui/commands/ve.ui.IndentationCommand.js
1 file changed, 1 insertion(+), 10 deletions(-)

Approvals:
  Jforrester: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/src/ui/commands/ve.ui.IndentationCommand.js 
b/src/ui/commands/ve.ui.IndentationCommand.js
index cf79048..088c6f0 100644
--- a/src/ui/commands/ve.ui.IndentationCommand.js
+++ b/src/ui/commands/ve.ui.IndentationCommand.js
@@ -32,20 +32,11 @@
  * @inheritdoc
  */
 ve.ui.IndentationCommand.prototype.isExecutable = function ( fragment ) {
-       var i, len, nodes, any;
        // Parent method
        if ( !ve.ui.IndentationCommand.super.prototype.isExecutable.apply( 
this, arguments ) ) {
                return false;
        }
-       nodes = fragment.getSelectedLeafNodes();
-       any = false;
-       for ( i = 0, len = nodes.length; i < len; i++ ) {
-               if ( nodes[ i ].hasMatchingAncestor( 'listItem' ) ) {
-                       any = true;
-                       break;
-               }
-       }
-       return any;
+       return fragment.hasMatchingAncestor( 'listItem' );
 };
 
 /* Registration */

-- 
To view, visit https://gerrit.wikimedia.org/r/315415
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I776f5a777189695a7fdcbe32323b34b732765fa5
Gerrit-PatchSet: 3
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <esand...@wikimedia.org>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to