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

Change subject: Remove ve.ce.Node.prototype.onAttributeChange
......................................................................


Remove ve.ce.Node.prototype.onAttributeChange

There was code in there once, but it's now empty. Removed it in favor
of adding explicit listeners in the handful of subclasses that
override it.

Change-Id: I160e55ad3c7d85c9f830a4bd7d42ec5dc18ad04f
---
M modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
M modules/ve-mw/ce/nodes/ve.ce.MWInlineImageNode.js
M modules/ve-mw/ce/nodes/ve.ce.MWReferenceListNode.js
M modules/ve/ce/nodes/ve.ce.ImageNode.js
M modules/ve/ce/ve.ce.Node.js
5 files changed, 30 insertions(+), 24 deletions(-)

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



diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js 
b/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
index 7943b5f..ef7308d 100644
--- a/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
+++ b/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
@@ -94,6 +94,9 @@
                        captionView.setLive( this.live );
                }
        }
+
+       // Events
+       this.model.connect( this, { 'attributeChange': 'onAttributeChange' } );
 };
 
 /* Inheritance */
@@ -174,7 +177,16 @@
 
 };
 
-/** */
+/**
+ * Update the rendering of the 'align', src', 'width' and 'height' attributes 
when they change
+ * in the model.
+ *
+ * @method
+ * @param {string} key Attribute key
+ * @param {string} from Old value
+ * @param {string} to New value
+ * @emits setup
+ */
 ve.ce.MWBlockImageNode.prototype.onAttributeChange = function ( key, from, to 
) {
        var $element, type;
 
diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWInlineImageNode.js 
b/modules/ve-mw/ce/nodes/ve.ce.MWInlineImageNode.js
index db60317..934d5e1 100644
--- a/modules/ve-mw/ce/nodes/ve.ce.MWInlineImageNode.js
+++ b/modules/ve-mw/ce/nodes/ve.ce.MWInlineImageNode.js
@@ -58,6 +58,9 @@
 
        // DOM changes
        this.$.addClass( 've-ce-mwInlineImageNode' );
+
+       // Events
+       this.model.connect( this, { 'attributeChange': 'onAttributeChange' } );
 };
 
 /* Inheritance */
@@ -81,7 +84,14 @@
 
 /* Methods */
 
-/** */
+/**
+ * Update the rendering of the 'src', 'width' and 'height' attributes when 
they change in the model.
+ *
+ * @method
+ * @param {string} key Attribute key
+ * @param {string} from Old value
+ * @param {string} to New value
+ */
 ve.ce.MWInlineImageNode.prototype.onAttributeChange = function ( key, from, to 
) {
        if ( key === 'height' || key === 'width' ) {
                to = parseInt( to, 10 );
diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWReferenceListNode.js 
b/modules/ve-mw/ce/nodes/ve.ce.MWReferenceListNode.js
index b93f9a0..072f6a5 100644
--- a/modules/ve-mw/ce/nodes/ve.ce.MWReferenceListNode.js
+++ b/modules/ve-mw/ce/nodes/ve.ce.MWReferenceListNode.js
@@ -34,6 +34,9 @@
        this.$refmsg = $( '<p>' )
                .addClass( 've-ce-mwReferenceListNode-muted' );
 
+       // Events
+       this.model.connect( this, { 'attributeChange': 'onAttributeChange' } );
+
        // Initialization
        this.update();
 };
@@ -102,7 +105,7 @@
 };
 
 /**
- * Handle attribute change events.
+ * Rerender when the 'listGroup' attribute changes in the model.
  *
  * @param {string} key Attribute key
  * @param {string} from Old value
diff --git a/modules/ve/ce/nodes/ve.ce.ImageNode.js 
b/modules/ve/ce/nodes/ve.ce.ImageNode.js
index 539e02b..0284537 100644
--- a/modules/ve/ce/nodes/ve.ce.ImageNode.js
+++ b/modules/ve/ce/nodes/ve.ce.ImageNode.js
@@ -32,6 +32,7 @@
 
        // Events
        this.$.on( 'click', ve.bind( this.onClick, this ) );
+       this.model.connect( this, { 'attributeChange': 'onAttributeChange' } );
 
        // Initialization
        this.$image
@@ -63,10 +64,7 @@
 /* Methods */
 
 /**
- * Handle attribute change events.
- *
- * Whitelisted attributes will be added or removed in sync with the DOM. They 
are initially set in
- * the constructor.
+ * Update the rendering of the 'src', 'width' and 'height' attributes when 
they change in the model.
  *
  * @method
  * @param {string} key Attribute key
diff --git a/modules/ve/ce/ve.ce.Node.js b/modules/ve/ce/ve.ce.Node.js
index 93addd9..f09ed61 100644
--- a/modules/ve/ce/ve.ce.Node.js
+++ b/modules/ve/ce/ve.ce.Node.js
@@ -25,9 +25,6 @@
 
        // Properties
        this.parent = null;
-
-       // Events
-       this.model.connect( this, { 'attributeChange': 'onAttributeChange' } );
 };
 
 /* Inheritance */
@@ -51,20 +48,6 @@
 ve.ce.Node.static.canBeSplit = false;
 
 /* Methods */
-
-/**
- * Handle attribute change events.
- *
- * Whitelisted attributes will be added or removed in sync with the DOM. They 
are initially set in
- * the constructor.
- *
- * @method
- * @param {string} key Attribute key
- * @param {string} from Old value
- * @param {string} to New value
- */
-ve.ce.Node.prototype.onAttributeChange = function () {
-};
 
 /**
  * Get allowed child node types.

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I160e55ad3c7d85c9f830a4bd7d42ec5dc18ad04f
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to