Fix exception when trying to use non-existent 'typeof' attribute

Bug: T272090
Change-Id: I4d1e7457441f28d789dec8b7fd2dc3ba10fd995e
This commit is contained in:
Bartosz Dziewoński 2021-01-14 22:11:32 +01:00
parent c42e86f0f6
commit c20e7765ea
2 changed files with 2 additions and 2 deletions

View file

@ -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 ) )
)
)

View file

@ -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 )
)