From c20e7765ea38f6e50942be9239dfedc6850abab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Thu, 14 Jan 2021 22:11:32 +0100 Subject: [PATCH] Fix exception when trying to use non-existent 'typeof' attribute Bug: T272090 Change-Id: I4d1e7457441f28d789dec8b7fd2dc3ba10fd995e --- includes/CommentUtils.php | 2 +- modules/utils.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/CommentUtils.php b/includes/CommentUtils.php index b7645fc0c..d866c60f0 100644 --- a/includes/CommentUtils.php +++ b/includes/CommentUtils.php @@ -52,7 +52,7 @@ class CommentUtils { // Empty inline templates, e.g. tracking templates ( strtolower( $node->tagName ) === 'span' && - in_array( 'mw:Transclusion', explode( ' ', $node->getAttribute( 'typeof' ) ) ) && + in_array( 'mw:Transclusion', explode( ' ', $node->getAttribute( 'typeof' ) ?? '' ) ) && !self::htmlTrim( DOMCompat::getInnerHTML( $node ) ) ) ) diff --git a/modules/utils.js b/modules/utils.js index 7f3baea44..24e16e2c5 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -28,7 +28,7 @@ function isRenderingTransparentNode( node ) { // Empty inline templates, e.g. tracking templates ( node.tagName.toLowerCase() === 'span' && - node.getAttribute( 'typeof' ).split( ' ' ).indexOf( 'mw:Transclusion' ) !== -1 && + ( node.getAttribute( 'typeof' ) || '' ).split( ' ' ).indexOf( 'mw:Transclusion' ) !== -1 && // eslint-disable-next-line no-use-before-define !htmlTrim( node.innerHTML ) )