mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-23 16:06:53 +00:00
Use DOMCompat::getOuterHTML instead of doc->saveHTML()
The latter results in lots of extra HTML entity encoding. The former is built by the Parsing team and appears to result in no unexpected changes elsewhere in the document. As Parsoid's selser relies on HTML fragments being byte-for-byte equal, these changes were resulting in wikitext normalisations in untouched parts of the document ("dirty diffs"). Bug: T259855 Change-Id: Ib3cb605911e690ec3e8c2f9df25fd1a2e2849d7e
This commit is contained in:
parent
c26ca107db
commit
7b2448d2f0
|
@ -9,6 +9,7 @@ use DerivativeRequest;
|
|||
use DOMElement;
|
||||
use Title;
|
||||
use Wikimedia\ParamValidator\ParamValidator;
|
||||
use Wikimedia\Parsoid\Utils\DOMCompat;
|
||||
use Wikimedia\Parsoid\Utils\DOMUtils;
|
||||
|
||||
class ApiDiscussionToolsEdit extends ApiBase {
|
||||
|
@ -87,7 +88,7 @@ class ApiDiscussionToolsEdit extends ApiBase {
|
|||
'page' => $params['page'],
|
||||
'token' => $params['token'],
|
||||
'oldid' => $oldid,
|
||||
'html' => $doc->saveHtml(),
|
||||
'html' => DOMCompat::getOuterHTML( $doc->documentElement ),
|
||||
'summary' => $summary,
|
||||
'baserevid' => $revision->getId(),
|
||||
'starttimestamp' => wfTimestampNow(),
|
||||
|
|
|
@ -46,6 +46,7 @@ class CommentModifierTest extends CommentTestCase {
|
|||
// Uncomment this to write updated content to the "modified HTML" files:
|
||||
// self::overwriteHtmlFile( $expectedPath, $doc, $origPath );
|
||||
|
||||
// saveHtml is not dirty-diff safe, but for testing it is probably faster than DOMCompat::getOuterHTML
|
||||
self::assertEquals( $expectedDoc->saveHtml(), $doc->saveHtml(), $name );
|
||||
|
||||
// removeAddedListItem is not implemented on the server
|
||||
|
@ -89,6 +90,7 @@ class CommentModifierTest extends CommentTestCase {
|
|||
// Uncomment this to write updated content to the "reply HTML" files:
|
||||
// self::overwriteHtmlFile( $expectedPath, $doc, $origPath );
|
||||
|
||||
// saveHtml is not dirty-diff safe, but for testing it is probably faster than DOMCompat::getOuterHTML
|
||||
self::assertEquals( $expectedDoc->saveHtml(), $doc->saveHtml(), $name );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue