Permalink
Browse files

Cleaning up `jumpBlock()' a little

  • Loading branch information...
1 parent 2f3a8bd commit 3f2fc3c3da73ef6c056e65f8cf4c3ad5cc429692 Petro Salema committed Apr 5, 2012
Showing with 7 additions and 5 deletions.
  1. +7 −5 src/lib/aloha/markup.js
View
@@ -163,15 +163,12 @@ function blink( node ) {
* @TODO(petro): test with <pre>
*/
function jumpBlock( block, isGoingLeft ) {
- blink(block);
-
var range = new GENTICS.Utils.RangeObject();
var sibling = isGoingLeft ? prevVisibleNode( block )
: nextVisibleNode( block );
if ( !sibling || isBlock( sibling ) ) {
- var $landing = jQuery(
- '<div style="background:#f34">&nbsp;</div>' );
+ var $landing = jQuery( '<div>&nbsp;</div>' );
if ( isGoingLeft ) {
jQuery( block ).before( $landing );
@@ -189,7 +186,7 @@ function jumpBlock( block, isGoingLeft ) {
} else {
range.startContainer = range.endContainer = sibling;
range.startOffset = range.endOffset = isGoingLeft ?
- nodeLength( sibling ) : 0;
+ nodeLength( sibling ) : ( isOldIE ? 1 : 0 );
cleanupPlaceholders( range );
}
@@ -365,6 +362,11 @@ Aloha.Markup = Class.extend( {
}
var node = range.startContainer;
+
+ if ( !node ) {
+ return true;
+ }
+
var sibling;
// Versions of Internet Explorer that are older that 9, will

0 comments on commit 3f2fc3c

Please sign in to comment.