mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 22:35:41 +00:00
Make data-mw/body.html attribute comparable
Change-Id: Ie23c5816a18f4da84c3d40c13a8c048710389f4b
This commit is contained in:
parent
0f6bdb9071
commit
6a159001ab
|
@ -75,3 +75,30 @@ ve.test.utils.mwEnvironment = ( function () {
|
|||
teardown: teardownOverrides
|
||||
} );
|
||||
} )();
|
||||
|
||||
( function () {
|
||||
var getDomElementSummaryCore = ve.getDomElementSummary;
|
||||
|
||||
/**
|
||||
* Override getDomElementSummary to extract HTML from data-mw/body.html
|
||||
* and make it comparable.
|
||||
*
|
||||
* @method
|
||||
* @inheritdoc ve#getDomElementSummary
|
||||
*/
|
||||
ve.getDomElementSummary = function ( element, includeHtml ) {
|
||||
// "Parent" method
|
||||
return getDomElementSummaryCore( element, includeHtml, function ( name, value ) {
|
||||
var obj, html;
|
||||
if ( name === 'data-mw' ) {
|
||||
obj = JSON.parse( value );
|
||||
html = ve.getProp( obj, 'body', 'html' );
|
||||
if ( html ) {
|
||||
obj.body.html = ve.getDomElementSummary( $( '<div>' ).html( html )[ 0 ] );
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
return value;
|
||||
} );
|
||||
};
|
||||
} )();
|
||||
|
|
Loading…
Reference in a new issue