fix(core): 🐛 check for mw-heading wrapper first before mw-parser-output

The current implementation will fail with the new mw-heading wrapper
This commit is contained in:
alistair3149 2023-09-11 14:04:43 -04:00
parent 9cba4f5a63
commit 672740a23a
No known key found for this signature in database

View file

@ -230,16 +230,14 @@ final class BodyContent extends Partial {
$parentClasses = DOMCompat::getClassList( $parent );
// Only target page headings, but not other heading tags
// TODO: Drop this when T13555 is deployed on LTS
if ( !$parentClasses->contains( 'mw-parser-output' ) ) {
continue;
}
// Use the `<div class="mw-heading">` wrapper if it is present. When they are required
// (T13555), the querySelectorAll() above can use the class and this can be removed.
if ( $parentClasses->contains( 'mw-heading' ) ) {
$el = $parent;
} else if ( !$parentClasses->contains( 'mw-parser-output' ) ) {
// Only target page headings, but not other heading tags
// TODO: Drop this when T13555 is deployed on LTS
continue;
}
// This check can be removed too when we require the wrappers.