@@ -364,9 +364,6 @@ PadDiff.prototype._createDeletionChangeset = function (cs, startAText, apool) {
364364 } ;
365365 } ;
366366
367- const attribKeys = [ ] ;
368- const attribValues = [ ] ;
369-
370367 // iterate over all operators of this changeset
371368 while ( csIter . hasNext ( ) ) {
372369 const csOp = csIter . next ( ) ;
@@ -381,28 +378,17 @@ PadDiff.prototype._createDeletionChangeset = function (cs, startAText, apool) {
381378 if ( csOp . attribs && textBank !== '*' ) {
382379 const deletedAttrib = apool . putAttrib ( [ 'removed' , true ] ) ;
383380 let authorAttrib = apool . putAttrib ( [ 'author' , '' ] ) ;
384-
385- attribKeys . length = 0 ;
386- attribValues . length = 0 ;
381+ const attribs = [ ] ;
387382 Changeset . eachAttribNumber ( csOp . attribs , ( n ) => {
388- attribKeys . push ( apool . getAttribKey ( n ) ) ;
389- attribValues . push ( apool . getAttribValue ( n ) ) ;
390-
391- if ( apool . getAttribKey ( n ) === 'author' ) {
392- authorAttrib = n ;
393- }
383+ const attrib = apool . getAttrib ( n ) ;
384+ attribs . push ( attrib ) ;
385+ if ( attrib [ 0 ] === 'author' ) authorAttrib = n ;
394386 } ) ;
395-
396- const undoBackToAttribs = cachedStrFunc ( ( attribs ) => {
387+ const undoBackToAttribs = cachedStrFunc ( ( oldAttribsStr ) => {
397388 const backAttribs = [ ] ;
398- for ( let i = 0 ; i < attribKeys . length ; i ++ ) {
399- const appliedKey = attribKeys [ i ] ;
400- const appliedValue = attribValues [ i ] ;
401- const oldValue = Changeset . attribsAttributeValue ( attribs , appliedKey , apool ) ;
402-
403- if ( appliedValue !== oldValue ) {
404- backAttribs . push ( [ appliedKey , oldValue ] ) ;
405- }
389+ for ( const [ key , value ] of attribs ) {
390+ const oldValue = Changeset . attribsAttributeValue ( oldAttribsStr , key , apool ) ;
391+ if ( oldValue !== value ) backAttribs . push ( [ key , oldValue ] )
406392 }
407393
408394 return Changeset . makeAttribsString ( '=' , backAttribs , apool ) ;
0 commit comments