Shallow-copy annotation objects in HTMLConverter

This fixes an annotation contamination issue that was causing Rob's
tests to throw exceptions

Change-Id: Ic5171d600b0b2ff97cc569e1e6f9488fab177c7c
This commit is contained in:
Catrope 2012-06-06 12:21:01 -07:00
parent e524152319
commit ae3d31d447

View file

@ -178,7 +178,9 @@ ve.dm.HTMLConverter.generateAnnotatedContent = function( content, annotations )
annotationMap[ve.getHash( annotations[i] )] = annotations[i];
}
for ( i = 0; i < characters.length; i++ ) {
characters[i] = [characters[i], annotationMap];
// Make a shallow copy of the annotationMap object, otherwise adding an annotation
// to one character automatically adds it to all of others as well
characters[i] = [characters[i], ve.extendObject( {}, annotationMap )];
}
return characters;
};