Index: trunk/parsers/wikidom/lib/es/es.Surface.js |
— | — | @@ -518,13 +518,10 @@ |
519 | 519 | * @param selection {Selection} Range to apply annotation to |
520 | 520 | */ |
521 | 521 | Surface.prototype.annotateContent= function( method, annotation, selection ) { |
522 | | - var block; |
523 | | - var i; |
524 | | - |
| 522 | + // Fall back to current selection if no selection argument was given |
525 | 523 | if ( selection === undefined ) { |
526 | 524 | selection = this.selection; |
527 | 525 | } |
528 | | - var surface = this; |
529 | 526 | if ( selection.from && selection.to ) { |
530 | 527 | selection.normalize(); |
531 | 528 | var from = selection.start, |
— | — | @@ -534,7 +531,8 @@ |
535 | 532 | from.block.annotateContent( method, annotation, from.offset, to.offset ); |
536 | 533 | } else { |
537 | 534 | // Multiple block annotation |
538 | | - for ( i = from.block.getIndex(), end = to.block.getIndex(); i <= end; i++ ) { |
| 535 | + var block; |
| 536 | + for ( var i = from.block.getIndex(), end = to.block.getIndex(); i <= end; i++ ) { |
539 | 537 | block = this.doc.blocks[i]; |
540 | 538 | if ( block === from.block ) { |
541 | 539 | // From offset to length |