Index: trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js |
— | — | @@ -364,9 +364,13 @@ |
365 | 365 | |
366 | 366 | while ( node ) { |
367 | 367 | nodeType = node.getElementType(); |
368 | | - stack.push(nodeType); |
| 368 | + stack.splice( |
| 369 | + stack.length / 2, |
| 370 | + 0, |
| 371 | + { 'type': '/' + nodeType }, |
| 372 | + { 'type': nodeType, 'attributes': es.copyObject( node.element.attributes ) } |
| 373 | + ); |
369 | 374 | node = node.getParent(); |
370 | | - |
371 | 375 | if ( es.DocumentView.splitRules[ nodeType ].self === true ) { |
372 | 376 | nodeType = node.getElementType(); |
373 | 377 | if ( es.DocumentView.splitRules[ nodeType ].children === true) { |
— | — | @@ -374,16 +378,8 @@ |
375 | 379 | } |
376 | 380 | } |
377 | 381 | } |
378 | | - |
379 | | - var temp = []; |
380 | | - for ( var i = 0; i < stack.length; i++ ) { |
381 | | - temp.push( { 'type' : '/' + stack[i] } ); |
382 | | - } |
383 | | - for ( var i = stack.length - 1; i >= 0; i-- ) { |
384 | | - temp.push( { 'type' : stack[i] } ); |
385 | | - } |
386 | 382 | |
387 | | - var tx = this.documentView.model.prepareInsertion( this.selection.to, temp ); |
| 383 | + var tx = this.documentView.model.prepareInsertion( this.selection.to, stack ); |
388 | 384 | this.documentView.model.commit( tx ); |
389 | 385 | |
390 | 386 | this.selection.from = this.selection.to = this.documentView.getModel().getRelativeContentOffset( this.selection.to, 1 ); |