mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-27 16:30:12 +00:00
Fixes data-id for "follow" refs
"follow" refs are cloned, which can lead to issues with their data-objects conflicting with the initial node: if additional, possibly out-of-order processing is happening, we may end up accessing/modifying the data bag. In particular, we considered adding a call to the DOMNormalizer when serializing the reference bodies, and this was triggering an exception when accessing the DOMDiff of the cloned node. We are not considering this right now anymore, but cloning the NodeData may avoid issues of this type in the future. This patch also introduces a utility to do the clone+clone data bag in a single method call. Change-Id: Iccdae82dec81d488433981d764bea539609497eb
This commit is contained in:
parent
c24f5a18af
commit
57fb5617a9
|
@ -155,7 +155,7 @@ class Ref extends ExtensionTagHandler {
|
|||
if ( $hasRefName ) {
|
||||
// Follow content may have been added as spans, so drop it
|
||||
if ( DOMCompat::querySelector( $bodyElt, "span[typeof~='mw:Cite/Follow']" ) ) {
|
||||
$bodyElt = $bodyElt->cloneNode( true );
|
||||
$bodyElt = DOMDataUtils::cloneNode( $bodyElt, true );
|
||||
foreach ( $bodyElt->childNodes as $child ) {
|
||||
if ( DOMUtils::hasTypeOf( $child, 'mw:Cite/Follow' ) ) {
|
||||
// @phan-suppress-next-line PhanTypeMismatchArgumentSuperType
|
||||
|
|
Loading…
Reference in a new issue