Fix check for preformatted when stripping whitespace

Previous was checking by string match to 'preformatted' which didn't
match 'mwPreformatted'. Now using node factory to see if
hasSignificantWhitespace is set.

Bug: 54083
Change-Id: I1be2d4568df7848e08074d200fb374acd508f6fa
This commit is contained in:
Ed Sanders 2013-09-16 16:41:45 +01:00
parent 019a6f8e49
commit e7aed52d93

View file

@ -1153,10 +1153,12 @@ ve.dm.Converter.prototype.getDomSubtreeFromData = function ( data, container ) {
text = ''; text = '';
isStart = i > 0 && isStart = i > 0 &&
ve.dm.LinearData.static.isOpenElementData( data[i-1] ) && ve.dm.LinearData.static.isOpenElementData( data[i-1] ) &&
ve.dm.LinearData.static.getType( data[i-1] ) !== 'preformatted'; !ve.dm.nodeFactory.doesNodeHaveSignificantWhitespace(
ve.dm.LinearData.static.getType( data[i-1] )
);
// Continue forward as far as the plain text goes // Continue forward as far as the plain text goes
while ( typeof data[i] === 'string' ) { while ( typeof data[i] === 'string' ) {
// HACK: Skip over leading whitespace (bug 51462) in non-pre tags // HACK: Skip over leading whitespace (bug 51462) in non-whitespace-preserving tags
if ( !( isStart && data[i].match( /\s/ ) ) ) { if ( !( isStart && data[i].match( /\s/ ) ) ) {
text += data[i]; text += data[i];
isStart = false; isStart = false;