From f86b8aef747720bb279f6dbd430fda556dec4108 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Mon, 30 Mar 2015 19:06:54 +0100 Subject: [PATCH] Use new isVisible method Also make sure only one icon is appended in the case where $element consists of multiple siblings. Depends on I7b4d9a54c in core. Change-Id: I5a7985b7a2c709f079afcdfd5108d73cc7bfc688 --- modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js index 150f1ec821..a591715e8b 100644 --- a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js +++ b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js @@ -82,19 +82,12 @@ ve.ce.MWTransclusionNode.prototype.onSetup = function () { // Parent method ve.ce.MWTransclusionNode.super.prototype.onSetup.call( this ); - if ( - this.$element.text().trim().length === 0 && - // Check whether the element is too small to comfortably select - ( - this.$element.width() < 8 || - this.$element.height() < 8 - ) - ) { + if ( !this.isVisible() ) { // We have to reset the icon when it is reappended, because // setIcon also affects the classes attached to this.$element this.setIcon( 'template' ); // Reattach icon - this.$element.prepend( this.$icon ); + this.$element.first().prepend( this.$icon ); } else { // We have to clear the icon because if the icon's symbolic name // has not changed since the last time we rendered, this.setIcon()