Esanders has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/58905


Change subject: Fix constructor to call parent after this.$ has been corrected
......................................................................

Fix constructor to call parent after this.$ has been corrected

ve.ce.Model stores data in this.$. If the parent constructor is
called before this.$ is changed from being <img> to <a>/<span>
this causes problems with some traversal code expecting to find
data in the wrapping <a>/<span>.

Change-Id: Iaeb5c31173664afc10b78fb346b982658c0bc1d9
---
M modules/ve/ce/nodes/ve.ce.MWImageNode.js
1 file changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/05/58905/1

diff --git a/modules/ve/ce/nodes/ve.ce.MWImageNode.js 
b/modules/ve/ce/nodes/ve.ce.MWImageNode.js
index ede3591..8b9188d 100644
--- a/modules/ve/ce/nodes/ve.ce.MWImageNode.js
+++ b/modules/ve/ce/nodes/ve.ce.MWImageNode.js
@@ -14,13 +14,15 @@
  * @param {ve.dm.MWImageNode} model Model to observe
  */
  ve.ce.MWImageNode = function VeCeMWImageNode( model ) {
-       // Parent constructor
+       this.$image = this.$;
+       this.$ = $( '<' + ( model.getAttribute( 'isLinked' ) ? 'a' : 'span' ) + 
'>' );
+
+       // Parent constructor - needs to be called after this.$ has been fixed
+       // as data is stored in this.$.data( 'view' ) by ve.ce.View
        ve.ce.ImageNode.call( this, model );
 
        // Initialization
        this.$.addClass( 've-ce-MWImageNode' );
-       this.$image = this.$;
-       this.$ = $( '<' + ( model.getAttribute( 'isLinked' ) ? 'a' : 'span' ) + 
'>' );
 
        // Initialization
        this.$.attr( 'contenteditable', false ).append( this.$image );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaeb5c31173664afc10b78fb346b982658c0bc1d9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <esand...@wikimedia.org>

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

Reply via email to