mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-25 11:16:51 +00:00
Make the full document regex hack a bit more robust
Anchor the regex and make it look for doctype too Change-Id: I43abb6f214a28801642bde46b50f4ac12614d1e4
This commit is contained in:
parent
502a2a2e53
commit
4b086b94d7
|
@ -104,7 +104,7 @@ ve.init.mw.Target.onLoad = function ( response ) {
|
|||
} else {
|
||||
// HACK for backwards compatibility with older versions of Parsoid, detect whether
|
||||
// data.content is a document fragment or a full HTML document
|
||||
if ( data.content.match( /<(html|head|body)(>|\s)/ ) ) {
|
||||
if ( data.content.match( /^<(!doctype|html|head|body)(>|\s)/ ) ) {
|
||||
html = data.content;
|
||||
} else {
|
||||
html = '<!doctype html><html><head></head><body>' + data.content + '</body></html>';
|
||||
|
|
Loading…
Reference in a new issue