From 405afdce701cfad7ac02584c05d232af0f18c91b Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Thu, 14 Sep 2017 13:45:10 +0100 Subject: [PATCH] Strip RESTBase IDs from historical diffs Change-Id: I911d529204a97003ed233464709737b018918634 --- modules/ve-mw/init/ve.init.mw.DiffLoader.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/ve-mw/init/ve.init.mw.DiffLoader.js b/modules/ve-mw/init/ve.init.mw.DiffLoader.js index 68f1c3de0a..225ab4bf24 100644 --- a/modules/ve-mw/init/ve.init.mw.DiffLoader.js +++ b/modules/ve-mw/init/ve.init.mw.DiffLoader.js @@ -27,9 +27,16 @@ getModelFromResponse: function ( response ) { var doc, targetClass = ve.init.mw.DesktopArticleTarget, + metadataIdRegExp = ve.init.platform.getMetadataIdRegExp(), data = response ? ( response.visualeditor || response.visualeditoredit ) : null; if ( data && typeof data.content === 'string' ) { doc = targetClass.static.parseDocument( data.content, 'visual' ); + // Strip RESTBase IDs + Array.prototype.forEach.call( doc.querySelectorAll( '[id^="mw"]' ), function ( element ) { + if ( element.id.match( metadataIdRegExp ) ) { + element.removeAttribute( 'id' ); + } + } ); return targetClass.static.createModelFromDom( doc, 'visual' ); } return null;