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

Change subject: Added inline comment explaining not obvious purpose of code
......................................................................


Added inline comment explaining not obvious purpose of code

Change-Id: Ib9ea1307ebe58c03abd00dcf8b96681d6901a3d4
---
M modules/ve/ce/ve.ce.ContentBranchNode.js
1 file changed, 7 insertions(+), 0 deletions(-)

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



diff --git a/modules/ve/ce/ve.ce.ContentBranchNode.js 
b/modules/ve/ce/ve.ce.ContentBranchNode.js
index 674f825..f5cb3d4 100644
--- a/modules/ve/ce/ve.ce.ContentBranchNode.js
+++ b/modules/ve/ce/ve.ce.ContentBranchNode.js
@@ -24,6 +24,13 @@
        var lastTransaction;
 
        // Events
+       // Main purpose of code below is to increase performance by ensuring 
that renderContents() is
+       // called exactly once after transaction is processed. Case when 
childUpdate event is received
+       // multiple times is for instance when entire paragraph with multiple 
nodes inside it
+       // (e.g. <p>123<alien></alien>456</p>) is being annotated.
+       // Keeping reference to transaction object in view may look like anti 
pattern - however please
+       // have in mind that this transaction here is not being used in any 
other way than just as
+       // a flag to figure out if renderContents should be executed or not.
        this.on( 'childUpdate', ve.bind( function( transaction ) {
                if ( lastTransaction !== transaction ) {
                        lastTransaction = transaction;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib9ea1307ebe58c03abd00dcf8b96681d6901a3d4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Inez <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Trevor Parscal <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to