From 0d4b30f92769a90d4b5822d898774511ff9851e8 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Mon, 28 Sep 2015 19:36:48 -0700 Subject: [PATCH] MWInlineExtensionNode: Don't assume responses are always

-wrapper For the Score extension they aren't, and this causes JS errors in production. Change-Id: If556afa1046f460d7fdd29cb1c50ac93dad88fde --- modules/ve-mw/ce/nodes/ve.ce.MWExtensionNode.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWExtensionNode.js b/modules/ve-mw/ce/nodes/ve.ce.MWExtensionNode.js index 500a6b4967..5bd3a0b7e0 100644 --- a/modules/ve-mw/ce/nodes/ve.ce.MWExtensionNode.js +++ b/modules/ve-mw/ce/nodes/ve.ce.MWExtensionNode.js @@ -150,10 +150,10 @@ OO.inheritClass( ve.ce.MWInlineExtensionNode, ve.ce.MWExtensionNode ); */ ve.ce.MWInlineExtensionNode.prototype.onParseSuccess = function ( deferred, response ) { var data = response.visualeditor, - contentNodes = $( data.content ).get(); + contentNodes = $.parseHTML( data.content ); - // Inline nodes will come back in wrapper paragraphs, so unwrap them. - if ( contentNodes[ 0 ] && contentNodes[ 0 ].childNodes ) { + // Inline nodes may come back in a wrapper paragraph; in that case, unwrap it + if ( contentNodes.length === 1 && contentNodes[ 0 ].nodeType === 'P' ) { contentNodes = Array.prototype.slice.apply( contentNodes[ 0 ].childNodes ); } deferred.resolve( contentNodes );