From ae3d31d447656f1a8a747e0f465b70db858bebdf Mon Sep 17 00:00:00 2001 From: Catrope Date: Wed, 6 Jun 2012 12:21:01 -0700 Subject: [PATCH] Shallow-copy annotation objects in HTMLConverter This fixes an annotation contamination issue that was causing Rob's tests to throw exceptions Change-Id: Ic5171d600b0b2ff97cc569e1e6f9488fab177c7c --- modules/ve2/dm/ve.dm.HTMLConverter.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/ve2/dm/ve.dm.HTMLConverter.js b/modules/ve2/dm/ve.dm.HTMLConverter.js index f96172371d..dc9912dcf0 100644 --- a/modules/ve2/dm/ve.dm.HTMLConverter.js +++ b/modules/ve2/dm/ve.dm.HTMLConverter.js @@ -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; };