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

Change subject: Fix protectedness of MWReferenceList
......................................................................


Fix protectedness of MWReferenceList

The update() method wiped out the entire contents of the node, including
the shield that makes ce.ProtectedNode work. Fixed by only wiping out and
reconstructing the contents of the <ol>

Change-Id: Ib2978a72939884be67964ce8a3d89a570f70bfa3
---
M modules/ve/ce/nodes/ve.ce.MWReferenceListNode.js
1 file changed, 6 insertions(+), 4 deletions(-)

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



diff --git a/modules/ve/ce/nodes/ve.ce.MWReferenceListNode.js 
b/modules/ve/ce/nodes/ve.ce.MWReferenceListNode.js
index e84cbc8..8166d37 100644
--- a/modules/ve/ce/nodes/ve.ce.MWReferenceListNode.js
+++ b/modules/ve/ce/nodes/ve.ce.MWReferenceListNode.js
@@ -26,6 +26,8 @@
        // DOM Changes
        this.$.addClass( 've-ce-mwReferenceListNode', 'reference' )
                .attr( 'contenteditable', false );
+       this.$reflist = $( '<ol class="references">' );
+       this.$.append( this.$reflist );
 
        // Events
        this.model.getDocument().internalList.connect( this, { 'update': 
'onInternalListUpdate' } );
@@ -44,6 +46,8 @@
 /* Static Properties */
 
 ve.ce.MWReferenceListNode.static.name = 'mwReferenceList';
+
+ve.ce.MWReferenceListNode.static.tagName = 'div';
 
 /* Methods */
 
@@ -81,11 +85,11 @@
  */
 ve.ce.MWReferenceListNode.prototype.update = function () {
        var i, j, iLen, jLen, key, keyNodes, $li, itemNode,
-               $ol = $( '<ol class="references">' ),
                internalList = this.model.getDocument().internalList,
                listGroup = this.model.getAttribute( 'listGroup' ),
                nodes = internalList.getNodeGroup( listGroup );
 
+       this.$reflist.empty();
        if ( nodes && nodes.keyOrder.length ) {
                for ( i = 0, iLen = nodes.keyOrder.length; i < iLen; i++ ) {
                        key = nodes.keyOrder[i];
@@ -108,11 +112,9 @@
                                internalList.getItemNode( 
keyNodes[0].getAttribute( 'listIndex' ) )
                        );
                        $li.append( $( '<span class="reference-text">' ).html( 
itemNode.$.show() ) );
-                       $ol.append( $li );
+                       this.$reflist.append( $li );
                }
        } // TODO: Show a placeholder for an empty reference list in the 'else' 
section
-
-       this.$.html( $ol );
 };
 
 /* Registration */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib2978a72939884be67964ce8a3d89a570f70bfa3
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: 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