mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-12-18 01:30:32 +00:00
Use DOMUtils::hasTypeOf/matchTypeOf/addTypeOf consistently
The `typeof` attribute is a space-separated list. Use consistent methods to test for membership in that list. Try to set a good example by using ::addTypeOf() in general to set the value of the 'typeof' attribute, except when we are transferring values from one node to another. Move the *TypeOf method to DOMUtils from DOMDataUtils, eliminating some duplication. Create Wikimedia\Parsoid\Ext\DOMUtils so that extensions can use these methods as well. Change-Id: Ib2ef827ef1cf5e31a1ef0a5034cdd3d9a0212bdb
This commit is contained in:
parent
a174963f3e
commit
46f749b92f
|
@ -10,12 +10,12 @@ use stdClass;
|
||||||
use Wikimedia\Assert\Assert;
|
use Wikimedia\Assert\Assert;
|
||||||
use Wikimedia\Parsoid\Core\DomSourceRange;
|
use Wikimedia\Parsoid\Core\DomSourceRange;
|
||||||
use Wikimedia\Parsoid\Ext\DOMDataUtils;
|
use Wikimedia\Parsoid\Ext\DOMDataUtils;
|
||||||
|
use Wikimedia\Parsoid\Ext\DOMUtils;
|
||||||
use Wikimedia\Parsoid\Ext\ExtensionTagHandler;
|
use Wikimedia\Parsoid\Ext\ExtensionTagHandler;
|
||||||
use Wikimedia\Parsoid\Ext\ParsoidExtensionAPI;
|
use Wikimedia\Parsoid\Ext\ParsoidExtensionAPI;
|
||||||
use Wikimedia\Parsoid\Ext\PHPUtils;
|
use Wikimedia\Parsoid\Ext\PHPUtils;
|
||||||
use Wikimedia\Parsoid\Ext\WTUtils;
|
use Wikimedia\Parsoid\Ext\WTUtils;
|
||||||
use Wikimedia\Parsoid\Utils\DOMCompat;
|
use Wikimedia\Parsoid\Utils\DOMCompat;
|
||||||
use Wikimedia\Parsoid\Utils\DOMUtils;
|
|
||||||
|
|
||||||
class References extends ExtensionTagHandler {
|
class References extends ExtensionTagHandler {
|
||||||
/**
|
/**
|
||||||
|
@ -181,7 +181,7 @@ class References extends ExtensionTagHandler {
|
||||||
'typeof' => $nodeType
|
'typeof' => $nodeType
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
DOMDataUtils::addTypeOf( $linkBack, 'mw:Extension/ref' );
|
DOMUtils::addTypeOf( $linkBack, 'mw:Extension/ref' );
|
||||||
$dataParsoid = new stdClass;
|
$dataParsoid = new stdClass;
|
||||||
if ( isset( $nodeDp->src ) ) {
|
if ( isset( $nodeDp->src ) ) {
|
||||||
$dataParsoid->src = $nodeDp->src;
|
$dataParsoid->src = $nodeDp->src;
|
||||||
|
|
Loading…
Reference in a new issue