ve.ui.MWSaveDialog: Remove meta element filtering from wikitext preview

Once upon a time, we added code to filter <style> and <link> elements
from the rendering of templates in visual editor, because attempting
to cut them would crash Chrome (T52043).

There are at least three reasons why that is not needed here:
* The preview is not editable text, so you can't cut from it
* The Chrome bug was fixed 7 years ago anyway
* We now use TemplateStyles in articles and they work just fine

The code was added here in 9dd638a5ab
without explanation, I think it was just done for consistency.

Bug: T212085
Change-Id: I0712e3a081f04d0b74cda47652fa6eb118dfe7b2
This commit is contained in:
Bartosz Dziewoński 2020-03-05 16:55:34 +01:00
parent a28cf0fd42
commit d0c45940d0

View file

@ -198,7 +198,7 @@ ve.ui.MWSaveDialog.prototype.setDiffAndReview = function ( wikitextDiffPromise,
* @param {HTMLDocument} [baseDoc] Base document against which to normalise links, if document provided
*/
ve.ui.MWSaveDialog.prototype.showPreview = function ( docOrMsg, baseDoc ) {
var body, contents, $heading, redirectMeta, deferred,
var body, $heading, redirectMeta, deferred,
$redirect = $(),
categories = [],
modules = [],
@ -256,15 +256,12 @@ ve.ui.MWSaveDialog.prototype.showPreview = function ( docOrMsg, baseDoc ) {
);
}
// Remove metadata
contents = ve.filterMetaElements( Array.prototype.slice.call( body.childNodes ) );
this.$previewViewer.empty().append(
// TODO: This won't work with formatted titles (T122976)
$heading.text( docOrMsg.title || mw.Title.newFromText( ve.init.target.getPageName() ).getPrefixedText() ),
$redirect,
$( '<div>' ).addClass( 'mw-content-' + mw.config.get( 'wgVisualEditor' ).pageLanguageDir ).append(
contents
body.childNodes
)
);