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:
Catrope 2013-02-21 14:59:19 -08:00
parent 502a2a2e53
commit 4b086b94d7

View file

@ -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>';