mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-28 00:40:12 +00:00
Save fragments without storing data-* attribs onto the node
* This seems to work and also will make the job of keeping extensions
free of DOM state easier.
Arlo clarifies that this wasn't necessary since f7594328
and could
have been cleaned up there.
Change-Id: I96edaa5b2743f1ce0d8596acfdc59035491541cb
This commit is contained in:
parent
2f9f5e25ef
commit
aebd6bcdcd
|
@ -99,6 +99,7 @@ class RefGroup {
|
|||
);
|
||||
if ( $refContentId ) {
|
||||
$content = $extApi->getContentDOM( $refContentId );
|
||||
DOMDataUtils::visitAndStoreDataAttribs( $content );
|
||||
DOMUtils::migrateChildrenBetweenDocs( $content, $reftextSpan );
|
||||
DOMDataUtils::visitAndLoadDataAttribs( $reftextSpan );
|
||||
}
|
||||
|
|
|
@ -121,15 +121,11 @@ class References extends ExtensionTag {
|
|||
/** @var DOMElement $c */
|
||||
$c = $extApi->getContentDOM( $contentId );
|
||||
DOMUtils::assertElt( $c );
|
||||
// All the actions that require loaded data-attributes on `c` are done
|
||||
// here so that we can quickly store those away for later.
|
||||
DOMDataUtils::visitAndLoadDataAttribs( $c );
|
||||
$cDp = DOMDataUtils::getDataParsoid( $c );
|
||||
$refDmw = DOMDataUtils::getDataMw( $c );
|
||||
if ( empty( $cDp->empty ) && self::hasRef( $c ) ) { // nested ref-in-ref
|
||||
self::processRefs( $extApi, $refsData, $c );
|
||||
}
|
||||
DOMDataUtils::visitAndStoreDataAttribs( $c );
|
||||
|
||||
// Use the about attribute on the wrapper with priority, since it's
|
||||
// only added when the wrapper is a template sibling.
|
||||
|
@ -164,9 +160,7 @@ class References extends ExtensionTag {
|
|||
$html = '';
|
||||
$contentDiffers = false;
|
||||
if ( $ref->hasMultiples ) {
|
||||
// Use the non-pp version here since we've already stored attribs
|
||||
// before putting them in the map.
|
||||
$html = ContentUtils::toXML( $c, [ 'innerXML' => true ] );
|
||||
$html = ContentUtils::ppToXML( $c, [ 'innerXML' => true ] );
|
||||
$contentDiffers = $html !== $ref->cachedHtml;
|
||||
}
|
||||
if ( $contentDiffers ) {
|
||||
|
@ -176,6 +170,11 @@ class References extends ExtensionTag {
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME: This leaks internal information about how Parsoid handles the DOM.
|
||||
// $c may not be in canonical form anymore
|
||||
// and shouldn't be used beyond this point.
|
||||
$c = null;
|
||||
|
||||
DOMDataUtils::addAttributes( $linkBack, [
|
||||
'about' => $about,
|
||||
'class' => 'mw-ref',
|
||||
|
|
Loading…
Reference in a new issue