Fix porting bug from 005176a

Bug: T249742
Change-Id: Iabe86266c06b2cbc3c51b16b73d360a7182878f1
This commit is contained in:
Arlo Breault 2020-11-24 10:54:23 -05:00
parent 4c7108f553
commit b88f9ca881

View file

@ -118,8 +118,8 @@ class Ref extends ExtensionTagHandler {
if ( !$bodyElt ) {
$extraDebug = '';
$firstA = DOMCompat::querySelector( $node, 'a[href]' );
$href = $firstA->getAttribute( 'href' );
if ( $firstA && preg_match( '/^#/', $href ) ) {
if ( $firstA && preg_match( '/^#/', $firstA->getAttribute( 'href' ) ) ) {
$href = $firstA->getAttribute( 'href' );
try {
$ref = DOMCompat::querySelector( $extApi->getTopLevelDoc(), $href );
if ( $ref ) {
@ -129,7 +129,6 @@ class Ref extends ExtensionTagHandler {
// We are just providing VE with debugging info.
// So, ignore all exceptions / errors in this code.
}
if ( !$extraDebug ) {
$extraDebug = ' [reference ' . $href . ' not found]';
}