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

Change subject: Work around $.parseHTML( '' ) returning null
......................................................................


Work around $.parseHTML( '' ) returning null

$.parseHTML() always returns an array, except in this one case,
so checking .length of the return value almost always works except
when it blows up in your face.

Filed upsteam as https://github.com/jquery/jquery/issues/1997

Bug: T86056
Change-Id: If133a9df4d573b41b0ecb5bde47b3e6ada053921
(cherry picked from commit f71054d67d1c07041f3c73de42dfc7a2a65095d6)
---
M modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
1 file changed, 2 insertions(+), 1 deletion(-)

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



diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js 
b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
index 0cece3a..4f7f02f 100644
--- a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
+++ b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
@@ -102,7 +102,8 @@
                return this.onParseError.call( this, deferred );
        }
 
-       contentNodes = $.parseHTML( response.visualeditor.content, 
this.getModelHtmlDocument() );
+       // Work around https://github.com/jquery/jquery/issues/1997
+       contentNodes = $.parseHTML( response.visualeditor.content, 
this.getModelHtmlDocument() ) || [];
        // HACK: if $content consists of a single paragraph, unwrap it.
        // We have to do this because the PHP parser wraps everything in <p>s, 
and inline templates
        // will render strangely when wrapped in <p>s.

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If133a9df4d573b41b0ecb5bde47b3e6ada053921
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: wmf/1.25wmf14
Gerrit-Owner: Jforrester <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to